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

// Template Headers {{{
using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long; using vll = vector<long long>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity() ? std::numeric_limits<T>::infinty() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}

int solve() {
	int q; cin >> q;
	int n = 1000, m = 1000;
	vector<vll> g(n + 2, vll(m + 2));
	while (q--) {
		int lx, ly, rx, ry; cin >> lx >> ly >> rx >> ry;
		lx++, ly++;
		g[lx][ly]++;
		g[lx][ry + 1]--;
		g[rx + 1][ly]--;
		g[rx + 1][ry + 1]++;
	}
	ll ans = -BINF;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			g[i][j] += g[i][j - 1];
			g[i][j] += g[i - 1][j];
			g[i][j] -= g[i - 1][j - 1];
			ans = max(ans, g[i][j]);
		}
	}
	cout << ans << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0);
	// precompute();
	// int t; cin >> t; for (int i=1;i<=t;i++)
	solve();
	// cout << "Case #" << i << ": ", solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

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

// vim: fdm=marker



Measured memory_bytes: 10820
"""
N=int(input())

print(800*N-int(N/15)*200)
"""

N=int(input())
S=input()

max_n=0
temp=0
for strng in S:
	if strng=="I":
		temp+=1
		if max_n<temp:
			max_n=temp
	else:
		temp-=1
print(max_n)

Measured memory_bytes: 3060
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=a.index(1)
#print(x)

if n==k:
    print(1)
else:
    #if x<=k-1 or x>=n-k:
    if (n-k)%(k-1)==0:
        ans=1+(n-k)//(k-1)
    else:
        ans=1+(n-k)//(k-1)+1


    print(ans)

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

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

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

template<typename T> void fill_all(T& arr, const T& v) { arr = v; }
template<typename T, typename U> void fill_all(T& arr, const U& v) { for (auto& i : arr) fill_all(i, v); }

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl

struct edge { int to, cost; };

const LL LINF = 1LL<<60;
const int IINF = 1<<30;
const LL MOD = 1e9+7;

int main()
{
   vector<int> X(3);
   for (int i = 0; i < 3; ++i) {
      cin >> X[i];
   }

   int K; cin >> K;

   vector<vector<LL>> A(3);
   for (int i = 0; i < 3; ++i) {
      A[i].resize(X[i]);
      for (int j = 0; j < X[i]; ++j) {
         cin >> A[i][j];
      }
   }

   for (int i = 0; i < 3; ++i) {
      sort(A[i].rbegin(), A[i].rend());
   }

   vector<LL> best;

   for (int i = 0; i < X[0]; ++i) {
      for (int j = 0; j < X[1] && (i+1)*(j+1) <= K; ++j) {
         for (int k = 0; k < X[2] && (i+1)*(j+1)*(k+1) <= K; ++k) {
            best.push_back(A[0][i] + A[1][j] + A[2][k]);
         }
      }
   }

   sort(best.rbegin(), best.rend());

   for (int i = 0; i < K; ++i) {
      cout << best[i] << endl;
   }

   return 0;
}


Measured memory_bytes: 1404
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			char[] s = in.nextString().toCharArray();
			int len = s.length;
			int tpc = 0, tgc = 0;
			int apc = len/2, agc = len-len/2;

			for (int i = 0; i < len; i++) {
				if (s[i] == 'g') {
					tgc++;
				} else {
					tpc++;
				}
			}

			out.println(apc-tpc);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

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

	}
}


Measured memory_bytes: 23380
using System;

class MainClass
{
    public static void Main(string[] args)
    {
        var nk = Console.ReadLine().Split();
        var n = int.Parse(nk[0]);
        var k = int.Parse(nk[1]);

        var rsp = Console.ReadLine().Split();
        var r = int.Parse(rsp[2]);
        var s = int.Parse(rsp[0]);
        var p = int.Parse(rsp[1]);

        var t = Console.ReadLine();

        var u = new char[n + k];

        var sum = 0;
        for (int i = 0; i < n; i++)
        {
            if (t[i] == u[i]) continue;

            sum +=
                t[i] == 'r' ? r :
                t[i] == 's' ? s :
                t[i] == 'p' ? p :
                0;

            u[i + k] = t[i];
        }

        Console.WriteLine(sum);
    }
}


Measured memory_bytes: 13176
// ABC 155-C
// 2020.2.16 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

typedef long long ll;

#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)

int in() {   // 非負整数の入力
	int n = 0;
	int c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

ll ins() { // 文字列の入力　スペース以下の文字で入力終了
    ll n = 0;
	int c = gc();
    int w = 10;
	do n = (n << 5) + (c - 'a'+1), --w;
    while ((c = gc()) > ' ');
    return n << 5*w;
}

void outs(ll s) {
    int c, i = 5*9;
    while (c = (s >> i) & 31) pc(c+'a'-1), i -= 5;
    pc('\n');
}

void Usort(ll *a, int n) {
	int i, k;
#define B 8
#define BMSK 255 // (1<<8)-1
	int t1[1 << B], t2[1 << B];

	ll *tmp = malloc(n * sizeof(ll));
	for (k = 0; k < 8; ++k) {  // for 64ビット
		memset(t1, 0, sizeof(t1)), memset(t2, 0, sizeof(t2));
		for (i = 0; i < n; ++i)	t1[(a[i] >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t1[i+1] += t1[i];
		i = n; while (i--) tmp[--t1[(a[i] >> k*B) & BMSK]] = a[i];
		k++;
		for (i = 0; i < n; ++i) t2[(tmp[i] >> k*B) & BMSK]++;
		for (i = 0; i < BMSK; ++i) t2[i+1] += t2[i];
		i = n; while (i--) a[--t2[(tmp[i] >> k*B) & BMSK]] = tmp[i];
	}
	free(tmp);
#undef B
}

#define MAX 200005
ll s[MAX]; int N;
ll ans[MAX]; int M;

int main()
{
	int i, k, ma;

    N = in();
	for (i = 0; i < N; ++i) s[i] = ins();
	Usort(s, N);

	M = 0, k = 1, ma = 0;
	for (i = 1; i <= N; ++i) {
		if (s[i] == s[i-1]) ++k;
		else {
			if (k > ma) M = 0, ma = k;
			if (k == ma) ans[M++] = s[i-1];
			k = 1;
		}
	}
//printf("M=%d\n", M);
	for (i = 0; i < M; ++i) outs(ans[i]);
	return 0;
}


Measured memory_bytes: 4964
#include <stdio.h>
int main(void)
{
 int a,s,d,f;
	scanf("%d",&a);
	f=a%60;
	d=(a-f)/3600;
	s=(a-d*3600)/60;
	printf("%d:%d:%d\n",d,s,f);
	return 0;
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int mod = 1e9+7;

int main() {
  int n, m;
  cin >> n >> m;
  cout << (n == m ? "Yes" : "No") << endl; 
  return 0; 
}


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

def gcd(a,b):
  return a if not b else gcd(b,a%b)

if K in A:
  print("POSSIBLE")
else:
  if max(A)<K:
    print("IMPOSSIBLE")
  else:
    max_gcd=A[0]
    for i in range(N):
      max_gcd=gcd(max_gcd,A[i])
    #print(max_gcd)
    if (max(A)-K)%max_gcd==0:
      print("POSSIBLE")
    else:
      print("IMPOSSIBLE")

Measured memory_bytes: 14252
program test
integer::a,b,c,d,i,N,x,y,z,t,u,k,m
allocatable :: a(:), b(:)
read(*,*) N, c
z=N-c+1
allocate(a(N),b(z))
read(*, *)(a(i), i = 1,N)
do i=1,N-c+1
k=i+c-1
x=a(i)
y=a(k)
t=abs(x)
u=abs(y)
m=min(t,u)
b(i)=m+(y-x)
end do
d=minval(b)
print*,d
end program test

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m=0,a[100002]={0};
	cin>>n;
	for(int i=1;i<=200;i++){
		for(int j=1;j<=200;j++){
			for(int k=1;k<=200;k++){
				int t=i*i+j*j+k*k+i*j+i*k+k*j;
				if(t<=1e4)a[t]++;
				else break;	
			}
		}
	}
	for(int i=1;i<=n;i++){
		cout<<a[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3912
#include<stdio.h>

void trace(int A[],int N){
	int i;
	
	for(i=0;i<N;i++){
		if(i>0) printf(" ");
		printf("%d",A[i]);
	}
	
	printf("\n");
	}
	
void insertionSort(int A[],int N[]){
	int j,i,v;
	for(i=1;i<N;i++){
		v=A[i];
		j=i-1;
		while(j>=0 && A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		
		A[j+1]=v;
		trace(A,N);
	}
}

int main(){
	int N,i,j;
	int A[100];
	
	scanf("%d",&N);
	for(i=0;i<N;i++)scanf("%d",&A[i]);
	
	trace(A,N);
	insertionSort(A,N);
	
	return 0;
}



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

int main(){
	char f[9][9];
	while(1){
		bool flag=false;
		
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				if( scanf(" %c", &f[i][j])==EOF){
					flag=true;
					break;
				}
			} 
			if(flag) break;	
		}
		if(flag) break;

		bool ans=false;
		char c='1';
		for(int i=0; i<8; ++i){
			for(int j=0; j<8; ++j){
				
				if(f[j][i]==c){
					if(i<=6 && j<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j+1][i+1]==c){
						printf("A\n");	
						ans=true;
						break;
					}
					else if(j<=4 && f[j+1][i]==c && f[j+2][i]==c && f[j+3][i]==c){
						printf("B\n");	
						ans=true;
						break;
					}
					else if(i<=4 && f[j][i+1]==c && f[j][i+2]==c && f[j][i+3]==c){
						printf("C\n");	
						ans=true;
						break;
					}
					else if(1<=j && j<=6 && i<=6 && f[j+1][i]==c && f[j][i+1]==c && f[j-1][i+1]==c){
						printf("D\n");	
						ans=true;
						break;
					}
					else if(j<=6 && i<=5 && f[j][i+1]==c && f[j+1][i+1]==c && f[j+1][i+2]==c){
						printf("E\n");	
						ans=true;
						break;
					}
					else if(j<=5 && i<=6 && f[j+1][i]==c && f[j+1][i+1]==c && f[j+2][i+1]==c){
						printf("F\n");	
						ans=true;
						break;
					}
					else if(1<=j && i<=5 && f[j][i+1]==c && f[j-1][i+1]==c && f[j-1][i+2]==c){
						printf("G\n");	
						ans=true;
						break;
					}
											
				}
	
			}
			if(ans) break;
		}
			
	}
}

Measured memory_bytes: 1112
list_s = list(input())
for i in range(0, len(list_s)):
    if list_s[i] == 'U' or list_s[i] == 'D': continue
    elif (i % 2 == 0 and list_s[i] == 'R') or (i % 2 != 0 and list_s[i] == 'L'): continue
    else: print("No")
    exit()
print("Yes")

Measured memory_bytes: 9044
n, k = map(int, input().split())
s = input()
l = [0,0] if (s[0] == '0') else [0]
l += [i for i in range(1,n) if s[i-1] != s[i]]
l += [n] if (s[-1] == '1') else [n,n]

ll = len(l)
pl = 2 * k + 1
if (ll < pl):
    print(n)
else:
   print(max(l[pl+i]-l[i] for i in range(0, ll-pl+1, 2)))


Measured memory_bytes: 7876
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <vector>
#include <map>
#include<cstdio>
#include<functional>
#include <bitset>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define ll long long
using namespace std;
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
const ll INF = 1000000000000000000;
const ll MOD = 1e9 + 7;

int main()
{
	ll a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	ll ans = INF;
	rep(i, 2 * max(x, y) + 1) {
		ll cc = i * c;
		ll ac = 0;
		if (x - i/2 >= 0) {
			ac = (x - i/2) * a;
		}
		ll bc = 0;
		if (y - i/2 >= 0) {
			bc = (y - i/2) * b;
		}
		ans = min(ans, ac + bc + cc);
	}
	cout << ans << endl;
	system("pause");
}




Measured memory_bytes: 3692
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<bitset>

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

using namespace std;


int main(){
  long ii,jj,kk;
  vector<int> a;
  unsigned int x;
  std::bitset<32> dx(x);
  
  cin >> x;

  dx = x;
  
  cout << dx << endl;

  dx = ~x;
  
  cout << dx << endl;

  dx = x << 1;

  cout << dx << endl;
  
  dx = x >> 1;

  cout << dx << endl;
  
  return 0;
}



Measured memory_bytes: 3160
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
A = ILI()
print(max(A)-min(A))

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<sstream>
#include<string>
#include<utility>
#include<vector>

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 1000000000+7
using namespace std;
typedef long long ll;

int main(){
  int N, Q; cin >> N >> Q;
  string s; cin >> s;
  vector<int> apAC(N, 0);
  rep(i, 1, N){
    apAC[i] = apAC[i-1];
    if(s[i] == 'C' and s[i-1] == 'A') {
      apAC[i]++;
    }
  }
  rep(i, 0, Q){
    int l, r; cin >> l >> r;
    l--;  r--;
    cout << apAC[r]-apAC[l] << endl;
  }
  return 0;
}

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

using ll = long long;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	for (int i=1; i<=n; i++) {
		if (int(i*1.08) == n) {
			cout << i;
			return 0;
		}
	}
	cout << ":(";
	return 0;
}


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

namespace Competitive
{
    internal class Solution
    {
        public int H, W, K;
        public long MOD = 1000000007;
        public int[] used;
        public long[,] DP;
        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                H = line[0];
                W = line[1];
                K = line[2];
            }

            DP = new long[H+1, W];
            DP[0, K - 1] = 1;

            for (int i = 1; i <= H; i++)
            {
                for (int j = 0; j < W; j++)
                {
                    DP[i, j] += DP[i - 1, j] * Comb(j) * Comb(W - (j + 1));
                    DP[i, j] %= MOD;
                    if(j > 0) DP[i, j] += DP[i - 1, j-1] * Comb(j-1) * Comb(W - (j + 1));
                    DP[i, j] %= MOD;
                    if (j < W-1) DP[i, j] += DP[i - 1, j+1] * Comb(j) * Comb(W - (j + 2));
                    DP[i, j] %= MOD;
                }
            }

            Console.WriteLine(DP[H, 0]);
        }

        public long Comb(int w)
        {
            if (w < 0) return 0;
            if (w <= 1) return 1;
            if (w == 2) return 2;
            return Comb(w - 1) + Comb(w - 2);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int a = (C+B-1)/B, b = (A+D-1)/D;
    if(a <= b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3596
function main()
  
  N = parse(Int,readline())
  S = split(chomp(readline()),"")
  
  count = 0
  
  for i in 1:N-2
    
    if S[i] == "A" && S[i+1] == "B" && S[i+2] == "C"
      count += 1
    end
    
  end
  
  println(count)
  
end

main()

Measured memory_bytes: 110216
S = input()
T = input()
length = len(S)
keep_S = [[] for i in range(26)]  # ord(T[i])に対応する S を格納
keep_T = [[] for i in range(26)]  # ord(S[i])に対応する T を格納

for i in range(length):

    num_S = ord(T[i]) - ord('a')
    num_T = ord(S[i]) - ord('a')

    if S[i] in keep_S[num_S]:
        continue
    else:
        keep_S[num_S].append(S[i])

    if T[i] in keep_T[num_T]:
        continue
    else:
        keep_T[num_T].append(T[i])


for i in range(26):
    if (len(keep_T[i]) > 1) | (len(keep_S[i]) > 1):
        print('No')
        exit()
print('Yes')


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

# print(N)
# print(a)
# print(b)

count=0
k=0

for i in range(N):
    L=list(str(i+1))
    # print(L)
    
    S=sum(int(j) for j in L)
    # print(S)
    
    if a<=S and b>=S:
        count+=i+1
        k+=1

print(count)
# print(k)

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

/*#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#define mp make_pair
#define pb push_back
#define pll pair<LL,LL>
#define pii pair<int,int>
#define y second
#define x first
#define LL long long 
#define sqr(x) ((x)*(x))
#define pi acosl(-1)
#define MEM(x) memset(x,0,sizeof(x))
#define MEMS(x) memset(x,-1,sizeof(x))
using namespace std;

void solve(){
    int n;
    scanf("%d",&n);
    int a[200005];
    int b[200005];
    for(int i = 0;i<n;i++)scanf("%d",&a[i]);
    for(int i = 0;i<n;i++)scanf("%d",&b[i]);
    map<int,int> m2;
    map<int,int> m1;
    for(int i = 0;i<n;i++)m1[a[i]]++,m2[b[i]]++,m2[a[i]]++;
    set<pii> s;
    for(auto it:m2){
        if(it.y!=m1[it.x])
        s.insert(mp(it.y,it.x));
    }
    for(auto it:m2){
        if(it.y>n){
            printf("No\n");
            return ;
        }
    }
    printf("Yes\n");

    vector<int> v;
    for(int i = 0;i<n;i++){
        pii p =*s.rbegin();
        s.erase(p);
        if(p.y==a[i]){
            pii pp=*s.rbegin();
            s.erase(pp);
            s.insert(p);
            v.pb(pp.y);
            m2[pp.y]--;
            if(m2[pp.y]!=m1[pp.y]){
                s.insert(mp(m2[pp.y],pp.y));
            }
        }
        else{
            p.x--;
            v.pb(p.y);
            m2[p.y]--;
            if(m2[p.y]!=m1[p.y]){
                s.insert(mp(m2[p.y],p.y));
            }
        }
        s.erase(mp(m2[a[i]],a[i]));
        m2[a[i]]--;
        m1[a[i]]--;
        s.insert(mp(m2[a[i]],a[i]));
      /*  for(auto it:s){
            printf("%d %d\n",it.x,it.y);
        }
        for(auto it:v)printf("%d ",it);
        printf("\n");*/
    }
    for(auto it:v)printf("%d ",it);
    printf("\n");
}
int main(){
    int t=1;
    int T=1;
    while(t--){
        solve();
    }
}
/*
100
5
5 4
4 2
4 2 3
5 4 2 3 1
*/


Measured memory_bytes: 33312
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

string str[32]={"101",
                "000000",
                "000011",
                "10010001",
                "010001",
                "000001",
                "100101",
                "10011010",
                "0101",
                "0001",
                "110",
                "01001",
                "10011011",
                "010000",
                "0111",
                "10011000",
                "0110",
                "00100",
                "10011001",
                "10011110",
                "00101",
                "111",
                "10011111",
                "1000",
                "00110",
                "00111",
                "10011100",
                "10011101",
                "000010",
                "10010010",
                "10010011",
                "10010000"};
string af=" ',-.?";
string bf=" .,-'?";
 
string change_to_2(int n){
    string res = "";
    rep(i, 0, 5){
        res += '0' + n % 2;
        n /= 2;
    }
    reverse(all(res));
    return res;
}
 
signed main(){
    string s;
    while(getline(cin, s)){
        string tmp = "", ans = "";
        rep(i, 0, s.size()){
            if('A' <= s[i] && s[i] <= 'Z'){
                tmp += change_to_2(s[i] - 'A');
            }else{
                int p = bf.find(s[i]);
                tmp += change_to_2(p + 26);
            }
        }
        //cout << tmp <<endl;
        rep(i, 0, tmp.size()){
            bool f = false;
            int p;
            rep(j, 0, 32){
                if(str[j] == tmp.substr(i, (int)(str[j].size()))){
                    p = j; f = true; i += (int)(str[j].size()) - 1;
                    break;
                }
            }
            if(!f) break;
            if(p >= 6){
                ans += (char)('A' + (p - 6));
            }else{
                ans += af[p];
            }
        }
        cout << ans << endl;
    }
}

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

using namespace std;

int main(){

    ios::sync_with_stdio(0);
    int result = 0;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < s.size(); i++){
        if(s[i] != t[i]) result++;
    }
    cout << result;
    cin.tie(0);

}



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

int main() {
    int A, B, C; cin >> A >> B >> C;
    int K; cin >> K;
    int cnt = 0;
    while(A >= B){
        B *= 2;
        cnt++;
    }
    while(B >= C){
        C *= 2;
        cnt++;
    }
    if(cnt <= K){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
from collections import Counter

# まずは代入
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s).most_common()  # もうリストにしちゃった<3
# この時点で, cは個数が多い順に並んでる
# たとえば入力例1だと
# [('vet', 2), ('beet', 2), ('beat', 1), ('bed', 1), ('bet', 1)]

ans = []
max = c[0][1]  # 最大の個数は何か? 数値を代入
for item, count in c:
	if count == max:
		ans.append(item)
	else:
		break  # もうこれ以下は弱いのしかないのでbreakします

ans.sort()  # 辞書順に並べる

for i in range(len(ans)):
	print(ans[i])

Measured memory_bytes: 45040
#include<bits/stdc++.h>
using namespace std;
const int X = 4000001;

void solve()
{
    int n;
    cin >> n;
    int a[n];
    bitset<X> B;
    B[0] = 1;
    int s = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        B |= (B << a[i]);
        s += a[i];
    }
    s = (s + 1) / 2;
    while(s)
    {
        if(B[s])
        {
            cout << s;
            return;
        }
        s++;
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 1792
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

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

using ll = int64_t;

int main(int, const char**)
{
    ll n;
    cin >> n;
    map<ll, ll> counts;
    for(ll i = 2; i * i <= n; ++i)
    {
        while(n % i == 0)
        {
            if(counts.find(i) == counts.end())
            {
                counts[i] = 0;
            }
            counts[i]++;
            n /= i;
        }
    }
    if(n != 1)
    {
        counts[n] = 1;
    }
    ll ans = 0;
    for(auto c : counts)
    {
        ll b = 1;
        ll rest = c.second;
        while(b <= rest)
        {
            rest -= b;
            b++;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
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};
	FOR(i,1,K){
		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: 256
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[][] c = new int[3][3];
        for(int i = 0;i<3;i++){
            for(int j = 0;j<3;j++){
                c[i][j] = sc.nextInt();
            }
        }
        int kari = c[0][0] - c[0][1];
        if(kari == c[1][0] - c[1][1] && 
           kari == c[2][0] - c[2][1]){
            kari = c[0][1] - c[0][2];
            if(kari == c[1][1] - c[1][2] && 
               kari == c[2][1] - c[2][2]){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }else{
            System.out.println("No");
        }
        sc.close();
    }
}

Measured memory_bytes: 22868
fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).unwrap();
    let N: usize = n.trim().parse::<usize>().unwrap();

    let mut s_numbers = String::new();
    std::io::stdin().read_line(&mut s_numbers).unwrap();
    let mut numbers: Vec<i32> = s_numbers.trim().split_whitespace()
        .map(|x| x.parse().unwrap()).collect();


    numbers.sort();
    numbers.reverse();

    let mut alice = 0;
    let mut bob = 0;
    
    for i in 0..N {
        if i % 2 == 0 {
            alice += numbers[i];
        } else {
            bob += numbers[i];
        }
    }

    let answer = alice - bob;

    println!("{}", answer);

}

    



Measured memory_bytes: 4352
a,b,c = list(map(int,input().split()))
d,e,f = list(map(int,input().split()))
g,h,i = list(map(int,input().split()))
x = [0]
y = []
ans = "No"
y+=[a-x[0],d-x[0],g-x[0]]
x+=[b-y[0],c-y[0]]
if x[1]+y[1]==e and x[2]+y[1]==f and x[1]+y[2]==h and x[2]+y[2]==i:
  ans = "Yes"
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
int main(){
    int N;
    cin>>N;
    for(long long h=1;h<3501;h++){
        for(long long n=h;n<3501;n++){
            long long mo=4*h*n-N*(h+n),ch=N*h*n;
            if(mo==0)   continue;
            if(ch%mo==0&&mo>0){
                cout<<h<<' '<<n<<' '<<ch/mo<<endl;
                return 0;
            }
        }
    }
    return 0;       
}

Measured memory_bytes: 256
$mod = 10**9+7

def pow(a,b)
  if b == 1
    a
  elsif b%2 == 0
    (pow(a,b/2)**2)%$mod
  else
    (a*pow(a,b/2)**2)%$mod
  end
end

def create_fact(n)
  for i in 2..n
    $fact[i] = ($fact[i-1]*i)%$mod
  end
end

def create_fact_inv(n)
  $fact_inv[n] = pow($fact[n],$mod-2)
  n.downto(1) do |i|
    $fact_inv[i-1] = ($fact_inv[i]*i)%$mod
  end
end

def create_inv(n)
  for i in 1..n
    $inv[i] = ($fact[i-1]*$fact_inv[i])%$mod
  end
end

def init(n)
  $fact = Array.new(n+1,1)
  $fact_inv = Array.new(n+1,1)
  $inv = Array.new(n+1,0)
  create_fact(n)
  create_fact_inv(n)
  create_inv(n)
end

def combi(a,b)
  (($fact[a]*$fact_inv[b])%$mod)*$fact_inv[a-b]%$mod
end

init(1000010)
n = gets.to_i
a = gets.split.map(&:to_i)
ans = 1
a.each do |i|
    ans = ans.lcm(i)
end
ans %= $mod
c = 0
a.each do |i|
    c += $inv[i]
    # c -= $mod if c > $mod
end
puts ans*c%$mod

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

#define For(i,x,y) for (int i=x;i<y;i++)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=800+19;
const int oo=(1<<30)-1;

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

char s[N][N];
int dis[N][N];
pii Q[N*N];
int n,m,k,sx,sy,ans=oo,f,w;

void bfs(){
	memset(dis,-1,sizeof(dis));
	dis[sx][sy]=0;
	f=1,w=0;
	Q[1]=mp(sx,sy);
	while (f>w){
		w++;
		int x=Q[w].fi,y=Q[w].se;
		if (dis[x][y]==k) continue;
		For(i,0,4){
			int nx=x+dx[i],ny=y+dy[i];
			if (nx<1||nx>n||ny<1||ny>m||s[nx][ny]=='#') continue;
			if (dis[nx][ny]==-1){
				dis[nx][ny]=dis[x][y]+1;
				Q[++f]=mp(nx,ny);
			}
		}
	}
	For(i,1,n+1) For(j,1,m+1) if (dis[i][j]!=-1){
		int tmp=k+min(min(i-1,n-i),min(j-1,m-j));
		ans=min(ans,tmp);
	}
	printf("%d\n",ans/k+(ans%k!=0));
}

int main(){
	n=IN(),m=IN(),k=IN();
	For(i,1,n+1) scanf("%s",s[i]+1);
	For(i,1,n+1) For(j,1,m+1) if (s[i][j]=='S') sx=i,sy=j;
	bfs();
}

Measured memory_bytes: 8704
// AtCoder Beginner Contest 121
// D - XOR World
// https://atcoder.jp/contests/abc121/tasks/abc121_d
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll f(ll a, ll b)
{
    if (a == b) return a;
    if (a != 0) return f(0, a-1) ^ f(0, b);
    return ((((b+1)/2) & 1) ? 1 : 0) ^ ((b & 1) ? 0 : b); 
}

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

    cout << f(A, B) << endl;
}


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

typedef long long ll;
const int N = 5054, M = N * 2, mod = 1000000007;

int n, m = 0, E = 0;
int to[M], first[N], next[M];
int fact[N], finv[N];
int a[N], f[N];
int cG = 0, G[3];

inline void up(int &x, const int y) {x < y ? x = y : 0;}
ll PowerMod(ll a, int n, ll c = 1) {for (; n; n >>= 1, a = a * a % mod) if (n & 1) c = c * a % mod; return c;}

void init(int n) {
	int i;
	for (*fact = i = 1; i <= n; ++i) fact[i] = (ll)fact[i - 1] * i % mod;
	finv[n] = PowerMod(fact[n], mod - 2);
	for (i = n; i; --i) finv[i - 1] = (ll)finv[i] * i % mod;
}

inline ll A(int n, int r) {return (ll)fact[n] * finv[n - r] % mod;}
inline ll C(int n, int r) {return (ll)fact[n] * finv[r] % mod * finv[n - r] % mod;}

inline void addedge(int u, int v) {
	to[++E] = v, next[E] = first[u], first[u] = E;
	to[++E] = u, next[E] = first[v], first[v] = E;
}

int dfs(int x, int px = 0, bool upd = false) {
	int i, y, Sx = 1, Sy, max = 0;
	for (i = first[x]; i; i = next[i])
		if ((y = to[i]) != px)
			Sx += Sy = dfs(y, x, upd), up(max, Sy);
	fprintf(stderr, "%d %d %d\n",x,Sx,max);
	if (up(max, n - Sx), upd && max <= n / 2) G[cG++] = x;
	return Sx;
}

int main() {
	int i, j, k, u, v, s = 0, ans = 0;
	scanf("%d", &n), init(n);
	for (i = 1; i < n; ++i)	scanf("%d%d", &u, &v), addedge(u, v);
	dfs(1, 0, true);
	if (cG == 2) return printf("%d\n", int((ll)fact[n / 2] * fact[n / 2] % mod)), 0;
	assert(cG == 1);
	for (i = first[*G]; i; i = next[i]) a[m++] = dfs(to[i], *G);
	for (*f = 1, i = 0; i < m; s += a[i++])
		for (j = s; j >= 0; --j)
			for (k = 1; k <= a[i]; ++k)
				f[j + k] = (f[j + k] + C(a[i], k) * A(a[i], k) % mod * f[j]) % mod;
	for (i = 0; i <= n; ++i) ans = (ans + ll(i & 1 ? mod - f[i] : f[i]) * fact[n - i]) % mod;
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;

int main() {
  int N, sum_v = 0, sum_c = 0;

  cin >> N;

  vector<int> V(N), C(N);

  for(int i = 0; i < N; i++) {
    cin >> V.at(i);
  }

  for(int i = 0; i < N; i++) {
    cin >> C.at(i);
  }

  for(int i = 0; i < N; i++) {
    if(V.at(i) - C.at(i) > 0) {
      sum_v += V.at(i);
      sum_c += C.at(i);
    }
  }

  cout << sum_v - sum_c << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#define P pair<long long, long long>
#define ll long long 

using namespace std;

class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};
const long long int MOD=1e9+7;

int main(){
  long long n,m,k,a,b;
  cin >> n >> m >> k;
  vector<long long> f[100009], bl[100009]; 
  UnionFind uni(n);
  for(int i=0;i<m;i++){
    cin >> a >> b;
    a--;b--;
    uni.merge(a, b);
    f[a].push_back(b);
    f[b].push_back(a);
  }
  for(int i=0;i<k;i++){
    cin >> a >> b;
    a--;b--;
    bl[a].push_back(b);
    bl[b].push_back(a);
  }
  for(int i=0;i<n;i++){
    long long ans=0;
    ans += uni.size(i) - 1;
    ans -= f[i].size();
    for(int j=0;j<bl[i].size();j++){
      if(uni.issame(i, bl[i][j])){
        ans--;
      }
    }
    cout << ans << (i==n-1?"\n": " ");
  }
}


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

int main() {
	string s, t;
	while(cin >> s >> t){
		int n = s.size(), m = t.size(), ans = 0, c = 0;
		for(int i = 0; i < n; ++i){
			c = 0;
			for(int j = 0, k = i; j < m && k < n; ++j, ++k){
				if(s[k] == t[j]){
					c++;
				}
				else{
					ans = max(ans, c);
					c = 0;
				}
			}
            ans = max(ans, c);
		}
        
		for(int i = 0; i < m; ++i){
			c = 0;
			for(int j = 0, k = i; j < n && k < m; ++j, ++k){
				if(t[k] == s[j]){
					c++;
				}
				else{
					ans = max(ans, c);
					c = 0;
				}
			}
            ans = max(ans, c);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int n = 100;
        /*
        long n = long.Parse(Console.ReadLine());
        long[] input = new long[5];
        for(int a = 0; a < 5; a++)
        {
            input[a]=long.Parse(Console.ReadLine());
        }
        */
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        Console.WriteLine(input[0]*input[1]-input[0]-input[1]+1);


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  vector<int>ku(N * 2);
  for (int i = 0; i < N * 2; i ++) cin >> ku[i];
  sort(ku.begin(), ku.end());
  int ans = 0;
  for (int i = 0; i < N; i ++) {
    ans += ku[i * 2];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ll long long
int main()
{
	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//ll tt;	cin>>tt;	while(tt--)
	{
		ll n,i,j,k,sum;
		cin>>n;
			sum=0;

		for(i=1;i<=n;i++)
		{
			for(j=1;j<=n;j++)
			{
				for(k=1;k<=n;k++)
				{
					sum+=__gcd(i,__gcd(j,k));
				}
			}
		}

		cout<<sum;
 	}
	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
		
		
return 0;
}

Measured memory_bytes: 3764
N,X,Y = list(map(int,input().split()))
for i in range (1,N):
    a = max(N - 1 - (Y - X - 1) - (i - 1),0)
    if Y - X + 1 > 2 * i:
        b = Y - X + 1
        if i == 1:
            b = b - 1
    elif Y - X + 1 == 2 * i:
        b = i
    else:
        b = 0
    c = 0
    for j in range (max(X + 1 - i,1),X):
        if i - (X - j) == 1:
            c = c + 1
        elif 2 * (i - (X - j)) < Y - X + 1:
            c = c + 2
        elif 2 * (i - (X - j)) == Y - X + 1:
            c = c + 1
    for j in range(Y + 1,min(Y + i,N + 1)):
        if i - (j - Y) == 1:
            c = c + 1
        elif 2 * (i - (j - Y)) < Y - X + 1:
            c = c + 2
        elif 2 * (i - (j - Y)) == Y - X + 1:
            c = c + 1
        
    print(a+b+c)

Measured memory_bytes: 3444
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main 
{

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] first = br.readLine().split(" ");
		String[] second = br.readLine().split(" ");
		Dice3 dice1= new Dice3();
		Dice3 dice2 = new Dice3();
		
		for(int i=0;i<first.length;i++)
		{
			dice1.setNum(i,Integer.parseInt(first[i]));
			dice2.setNum(i,Integer.parseInt(second[i]));
		}
		
		System.out.println(dice1.equals(dice2) ? "Yes":"No");
		// TODO 自動生成されたメソッド・スタブ

	}
}

class Dice3
{
	int[] num;
	
	public Dice3()
	{
		num = new int[6];
	}
	public boolean isSame(Dice3 d)
	{
		for(int i=0;i<num.length;i++)
		{
			if(num[i] != d.num[i])return false;
		}
		
		return true;
	}
	@Override
	public boolean equals(Object o)
	{
		Dice3 D = (Dice3)o;
		
		for(int i=0;i<4;i++)
		{
			if(isSame(D))return true;
			rotateS();
			
			if(isSame(D))return true;
			
			for(int j=0;j<4;j++)
			{
				rotateE();
				if(isSame(D))return true;
			}
		}
		rotateW();
		
		for(int i=0;i<4;i++)
		{
			if(isSame(D))return true;
			rotateS();
			if(isSame(D))return true;
			for(int j=0;j<4;j++)
			{
				rotateE();
				if(isSame(D))return true;
			}
			
		}
		
		return false;
	}
	
	public void setNum(int index,int Num)
	{
		num[index] = Num;
	}
	
	public void rotateS()
	{
		int temp = num[0];
		num[0] = num[4];
		num[4] = num[5];
		num[5] = num[1];
		num[1] = temp;
	}
	
	public void rotateN()
	{
		int temp = num[0];
		num[0] = num[1];
		num[1] = num[5];
		num[5] = num[4];
		num[4] = temp;
	}
	
	public void rotateW()
	{
		int temp = num[0];
		num[0] = num[2];
		num[2] = num[5];
		num[5] = num[3];
		num[3] = temp;
	}
	
	public void rotateE()
	{
		int temp = num[0];
		num[0] = num[3];
		num[3] = num[5];
		num[5] = num[2];
		num[2] = temp;
	}
}

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

int main() {
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> data (H, vector<char>(W));
  for(int i = 0; i < H; i++){
    string A;
    cin >> A;
    for(int j = 0; j < W; j++){
      data.at(i).at(j) = A.at(j);
    }
  }
  //横--------------
  for(int i = 0; i < H; i++){
    int count = 0;
    
    for(int j = 0; j < W; j++){
      if(data.at(i).at(j) != '#'){
        count++;
      }
    }
    
    if(count == W){
      for(int k = 0; k < W; k++){
        data.at(i).at(k) = '-';
      }
    } 
  }
  //縦--------------
  for(int i = 0; i < W; i++){
    int count = 0;
    
    for(int j = 0; j < H; j++){
      if(data.at(j).at(i) != '#'){
        count++;
      }
    }
    
    if(count == H){
      for(int k = 0; k < H; k++){
        data.at(k).at(i) = '-';
      }
    } 
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(data.at(i).at(j) != '-'){
        cout << data.at(i).at(j);
      }
    }
    cout << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, ans = 0; cin >> n;
	for(int i = 1; i < n; i++) ans += (n - 1)/i;
	cout << ans;

	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
vector<vector<bool>> a(3,vector<bool>(3));
map<int, pair<int, int>> num;
bool check() {
  
  //true→ビンゴしてます
  /*
    cout << endl;
    for(int i=0; i<3; i++) {
    for(int j=0; j<3; j++) {
    cout << a[i][j] << " ";
    }
    cout << endl;
    }
  */
  
  bool ans = false;
  bool tmp;
  //縦チェック
  for(int i=0; i<3; i++) {
    tmp = true;
    for(int j=0; j<3; j++) {
      if(a[i][j] == false) tmp = false;
    }
    if(tmp == true) ans = true;
  }
  //横チェック
  for(int j=0; j<3; j++) {
    tmp = true;
    for(int i=0; i<3; i++) {
      if(a[i][j] == false) tmp = false;
    }
    if(tmp == true) ans = true;
  }
  //斜めチェック
  if(a[0][0] == true and a[1][1] == true and a[2][2] == true) ans = true;
  if(a[0][2] == true and a[1][1] == true and a[2][0] == true) ans = true;
  
  return ans;
}
bool bingo(int x) {
  if(num.count(x) != 0) {
    //番号があった
    a[num[x].first][num[x].second] = true;
  }
  
  if(check()) return true;
  else return false;
}
int main() {
  for(int i=0; i<3; i++) {
    for(int j=0; j<3; j++) {
      int tmp;
      cin >> tmp;
      num[tmp] = make_pair(i, j);
    }
  }
  //穴を開けていく
  int N;
  cin >> N;
  for(int i=0; i<N; i++) {
    int b;
    cin >> b;
    if(bingo(b)) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define ALL(x) (x).begin(),(x).end()
cpp_int MAG = 1000000;
inline cpp_int between(cpp_int n, cpp_int x) {
  if(n >= 0)
    return (n/x)+1;
  else
    return 0;
}

int main () {
  int l;
  cin >> l;
  long double triple = (l/3.0l) * (l/3.0l) * (l/3.0l);
  cout << fixed << setprecision(12) << triple << endl;
  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict
n,k=map(int,input().split())
a=list(map(int,input().split()))
a[0]=(a[0]-1)%k
for i in range(n-1):a[i+1]=(a[i+1]+a[i]-1)%k
d=defaultdict(int)
ans=0
d[0]=1
for i in range(n):
  if i==k-1:d[0]-=1
  if i>=k:d[a[i-k]]-=1
  ans+=d[a[i]]
  d[a[i]]+=1
print(ans)

Measured memory_bytes: 36100