akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        var S = System.Console.ReadLine();
        var T = System.Console.ReadLine();
        int counter = 0;
        for (int i = 0; i < S.Length; i++)
        {
            var s = S[i];
            var t = T[i];
            if (s != t)
            {
                counter++;
            }
        }
        Console.Write(counter);
    }
}


Measured memory_bytes: 27424
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <queue>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int h, w;
int sax, say, sbx, sby, gax, gay, gbx, gby;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
bool used[55][55][55][55];

bool can(int y, int x) {
	if(0 <= y && y < h && 0 <= x && x < w) return true;
	return false;
}

int main() {
	while(cin >> w >> h) {
		if(w == 0 && h == 0) break;

		string A[h], B[h];
		rep(i, h) cin >> A[i] >> B[i];
		rep(i, h) reverse(B[i].begin(), B[i].end());

		rep(i, h) {
			rep(j, w) {
				if(A[i][j] == 'L') {
					say = i;
					sax = j;
					A[i][j] = '.';
				}

				if(B[i][j] == 'R') {
					sby = i;
					sbx = j;
					B[i][j] = '.';
				}

				if(A[i][j] == '%') {
					gay = i;
					gax = j;
					A[i][j] = '.';
				}

				if(B[i][j] == '%') {
					gby = i;
					gbx = j;
					B[i][j] = '.';
				}
			}
		}

		queue<pair< P, P > > que;
		que.push(mp( mp(say, sax), mp(sby, sbx) ));

		memset(used, 0, sizeof(used));
		used[say][sax][sby][sbx] = true;

		bool flag = false;

		while(que.size()) {
			pair<P, P> p = que.front(); que.pop();

			int ay = p.first.first, ax = p.first.second;
			int by = p.second.first, bx = p.second.second;

			if(ay == gay && ax == gax && by == gby && bx == gbx) {
				flag = true;
				break;
			}

			if((ay == gay && ax == gax) || (by == gby && bx == gbx)) {
				continue;
			}

			rep(i, 4) {
				int nay = ay + dy[i];
				int nax = ax + dx[i];

				int nby = by + dy[i];
				int nbx = bx + dx[i];

				if(!can(nay, nax) || A[nay][nax] == '#') {
					nay -= dy[i];
					nax -= dx[i];
				}

				if(!can(nby, nbx) || B[nby][nbx] == '#') {
					nby -= dy[i];
					nbx -= dx[i];
				}

				if(!used[nay][nax][nby][nbx]) {
					que.push(mp( mp(nay, nax), mp(nby, nbx) ));
					used[nay][nax][nby][nbx] = true;
				}
			}
		}

		if(flag) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 11096
#include <iostream>
#include <algorithm>

std::string solve(const std::string &s) {
    std::string dream = "maerd", dreamer = "remaerd", erase = "esare", eraser = "resare";
    int idx = 0;
    while (idx < s.size()) {
        if (s.substr(idx, 5) == dream || s.substr(idx, 5) == erase)
            idx += 5;
        else if (s.substr(idx, 6) == eraser)
            idx += 6;
        else if (s.substr(idx, 7) == dreamer)
            idx += 7;
        else
            return "NO";
    }
    return "YES";
}

int main() {
    std::string s;
    std::cin >> s;
    std::reverse(s.begin(), s.end());
    std::cout << solve(s) << std::endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
int main() 
{ 
int a,b,c;
cin>>a>>b>>c;
 int d=a+b;
if(d>=c)
cout<<"Yes";
else
cout<<"No";

return 0;  
}

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

class tsort {
public:
  int V;
  vector<vector<int>> G;
  vector<int> deg, res;
  tsort(int node_size) : V(node_size), G(V), deg(V, 0) {}
  void add(int from, int to) {
    G.at(from).push_back(to);
    deg.at(to)++;
  }
  bool solve() {
    queue<int> que;
    for(int i = 0; i < V; i++) {
      if(deg.at(i) == 0) {
        que.push(i);
      }
    }
    while(!que.empty()) {
      int p = que.front();
      que.pop();
      res.push_back(p);
      for(int v : G.at(p)) {
        if(--deg.at(v) == 0) {
          que.push(v);
        }
      }
    }
    return (*max_element(deg.begin(),deg.end()) == 0);
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> G(N);
  tsort T(N);
  for (int i = 0; i < N - 1 + M; i++) {
    int a, b;
    cin >> a >> b;
    G.at(--b).push_back(--a);
    T.add(a, b);
  }
  T.solve();
  vector<int> V(N);
  int rank = 0;
  for (auto r : T.res) V.at(r) = rank++;
  for (int i = 0; i < N; i++) {
    if (G.at(i).size() == 0) {
      cout << 0 << "\n";
      continue;
    }
    int ans, mx = -1;
    for (auto g : G.at(i)) if (V.at(g) > mx) mx = V.at(g), ans = g;
    cout << ans + 1 << "\n";
  }
}

Measured memory_bytes: 13052
import sys
n=int(input())
l=[list(map(int,input().split())) for i in range(n)] 
t=0
x=0
y=0
for i in range(n):
    
    t1=l[i][0]
    x1=l[i][1]
    y1=l[i][2]
    dt=t1-t
    md=abs(x-x1)+abs(y-y1)

    if dt >= md and (dt - md) % 2 == 0:
        t=t1
        x=x1
        y=y1
    else:
        print("No")
        sys.exit()

print("Yes")


Measured memory_bytes: 27380
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		int N = line.indexOf("N")<0 ? 1 : 0;
		int S = line.indexOf("S")<0 ? 1 : 0;
		int W = line.indexOf("W")<0 ? 1 : 0;
		int E = line.indexOf("E")<0 ? 1 : 0;
		boolean ns = false;
		boolean we = false;

		if(N==S){
			ns = true;
		}
		if(W==E){
			we = true;
		}

		if(ns && we){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}

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

int main(){
    int inf = 1e9;
    int N,M;
    while(cin >> N >> M && N){
        vector<int> C(M+1),X(N+1);
        vector<vector<int>> dp(N+1,vector<int>(256,inf));
        dp[0][128] = 0;
        for(int i=1;i<=M;i++) cin >> C[i];
        for(int i=1;i<=N;i++) cin >> X[i];
        for(int i=0;i<N;i++) for(int j=0;j<=255;j++){
            for(int k=1;k<=M;k++){
                int ne = j+C[k];
                if(ne>255) ne = 255;
                if(ne<0) ne = 0;
                dp[i+1][ne] = min(dp[i+1][ne],dp[i][j]+(X[i+1]-ne)*(X[i+1]-ne));
            }
        }
        int ans = inf;
        for(int i=0;i<=255;i++) ans = min(ans,dp[N][i]);
        cout << ans << endl;
    }
}


Measured memory_bytes: 23792
k = int(input())

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[k-1])

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

#define llint long long int

using namespace std;

int main(){
    llint N, K;

    cin >> N >> K;

    llint ans = 0;

    for(llint i = K; i <= N + 1; i ++){
        ans += (N - i + 1) * i + 1;
        ans %= 1000000000 + 7;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

#define fi first
#define se second

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b,c;
	cin>>a>>b>>c;
	ll val=a-b;
	cout<<max(0LL,c-val);
    return 0;
}


//252908XL

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define min(x,y)(x>y?y:x)
int table[50][26];
int main(){
	for(int j=0;j<3;j++){
		for(int i=0;i<26;i++){
			table[j][i]=0;
		}
	}
	int n=0;
	cin>>n;
	string s;
	for(int i=0;i<n;i++){
		cin>>s;
		int length=s.length();
		for(int j=0;j<length;j++){
			table[i][s[j]-'a']++;
		}
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<26;j++){
			table[0][j]=min(table[0][j],table[i][j]);
		}
	}
	for(int i=0;i<26;i++){
		int n=table[0][i];
		char a=i+'a';
		for(int j=0;j<n;j++){
			cout<<a;
		}
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading;

class Program
{
    
    static void Main(string[] args)
    {
        int[] arr = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        string a = "";
        string b = "";
        for(int i = 0; i < arr[1]; i++)
        {
            a += arr[0].ToString();
        }
        for (int i = 0; i < arr[0]; i++)
        {
            b += arr[1].ToString();
        }
        var list = new List<string>();
        list.Add(a);
        list.Add(b);
        list.Sort();
        Console.WriteLine(list[0]);


    }

}

   

Measured memory_bytes: 28320
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	int n;
	cin >> n;
	map<string, int> mp = { {"AC",0},{"WA",0},{"TLE",0},{"RE",0} };
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);

int main() {
    int N;
    cin >> N;
    vector<P> D(N);
    REP(i,N) cin >> D[i].first >> D[i].second;
    bool ok = false;
    if(N == 3) {
        int i = 0;
        if(D[i].first == D[i].second && D[i+1].first == D[i+1].second && D[i+2].first == D[i+2].second) ok = true;
        cout << (ok ? "Yes" : "No") << endl;
        return 0;
    }
    REP(i,N-3) {
        if(D[i].first == D[i].second && D[i+1].first == D[i+1].second && D[i+2].first == D[i+2].second) ok = true;
    }
    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
	char S[11];int i;char *p=S;char q;
	for(i=0;i<10;i++)
	scanf("%c",&S[i]);
	*(p+3)='8';
	for(i=0;i<10;i++)
	printf("%c",S[i]);
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <bitset>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

ll Length( ll n ){
    ll l = 0;
    while (n > 0){
        l ++;
        n /= 2;
    }
    return l;
}

ll pow2(ll n){
    ll ret = 1;
    for(int i = 0; i < n; i++){
        ret *= 2;
    }
    return ret;
}

int main(){

    ll N, K;
    cin >> N >> K;

    vector<ll> v(N);
    for(ll i = 0; i < N; i++) cin >> v[i];

    ll cnt[40] = {0};
    for(ll i = 0; i < N; i++){
        bitset<40> bs(v[i]);
        for(int j = 0; j < 40; j++){
            if(bs[j]) cnt[j] ++;
        }
    }

    ll ans = 0;
    ll length = Length(K);
    if(DEBAG) cout << "length is " << length << endl; 

    bitset <40> bsk(K);
    bool maxFlag = false; // 最大値を越える可能性
    for(ll i = 39; i >= 0; i--){

        if(bsk[i]){
            if(cnt[i] > N - cnt[i] ){ // choose 0
                ans = ans + pow2( (ll)i ) * cnt[i];
                maxFlag = true;
            }
            else{ 
                ans = ans + pow2( (ll)i ) * ( N - cnt[i] );
            }
        }
        else if( !bsk[i] && maxFlag){
            if(cnt[i] > N - cnt[i] ){ 
                ans = ans + pow2( (ll)i ) * cnt[i];
                maxFlag = true;
            }
            else{
                ans = ans + pow2( (ll)i ) * ( N - cnt[i] );
            }
        }
        else{
            ans = ans + pow2( (ll)i ) * cnt[i];
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 1024
let n = read_int ();;

module UnionFind =
  struct
    type unionfind = { size : int array; parent : int array };;
    let make n = {size = Array.make n 1; parent = Array.init n (fun i -> i)};;
    let rec find uf x = (
        if uf.parent.(x) = x then
          x
        else (
          let y = find uf (uf.parent.(x)) in
          uf.parent.(x) <- y;
          y
        )
      );;
    let unite uf x y = (
        let x = find uf x in
        let y = find uf y in
        if x <> y then (
          let x, y = if uf.size.(x) > uf.size.(y) then x, y else y, x in
          uf.size.(x) <- uf.size.(x) + uf.size.(y);
          uf.parent.(y) <- x;
        );
      )
  end;;

let uf = UnionFind.make 200000;;

for i = 0 to n - 1 do
  let x, y = Scanf.scanf " %d %d" (fun x y -> x - 1, y - 1 + 100000) in
  UnionFind.unite uf x y
done;;

let row = Array.make 200000 0;;
let col = Array.make 200000 0;;

for i = 0 to 99999 do
  let j = UnionFind.find uf i in
  row.(j) <- row.(j) + 1;
done;;

for i = 100000 to 199999 do
  let j = UnionFind.find uf i in
  col.(j) <- col.(j) + 1;
done;;

let ans = ref (-n);;
for i = 0 to 199999 do
  ans := !ans + row.(i) * col.(i);
done;;

Printf.printf "%d\n" !ans;;


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

int main(int argc, char const *argv[]) {
    int A, B;
    cin >> A >> B;

    if ((A+B) % 2 == 0) {
        cout << (A+B) / 2 << endl;
    } else {
        cout << "IMPOSSIBLE" << endl;
    }

    return 0;
}


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

int n,cnt=0; 

int check(int x,int y,int z,int n)
{
	int flag=0;
	if(x*x+y*y+z*z+x*y+y*z+z*x==n)
		flag=1;
	return flag;
}
int book[6000003];
int main()
{
	cin>>n;
	rep(x,1,101)
	{
		rep(y,1,101)
		{
			rep(z,1,101)
			{
				book[x*x+y*y+z*z+x*y+y*z+z*x]+=1;
			}
		}
	}
	int ans=0; 
	rep(i,1,n+1)
	{
		cout<<book[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define INF INT_MAX;
typedef long long ll;
using namespace std;

int main(){
  int x = 'a'-'A';
  string a,b,c;
  cin >> a  >> b >> c;
  printf("%c%c%c",a[0]-x,b[0]-x,c[0]-x);
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>

using namespace std;

int main(){

	string s;

	cin >> s;

	cout << s.substr(0,1) + to_string(s.size() - 2) + s.substr(s.size()-1,1);


    return 0;

}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<PLL> p(n);
  ll ans = 0;
  rep(i, n) { cin >> p[i].second >> p[i].first; }
  sort(all(p));
  ans += p.back().second - 1;
  ans += p[0].first;
  rep(i, n - 1) { ans += p[i].second - p[i+1].second; }
  cout << ans+1 << endl;
  return 0;
}


Measured memory_bytes: 1792
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = sc.nextInt();
        int[][] a = new int[n][3];
        int[][] b = new int[n][3];
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            a[i] = new int[]{i, x, y};
            b[i] = new int[]{i, x, y};
        }
        Arrays.sort(a, (x,y) -> y[1] - x[1]);
        Arrays.sort(b, (x,y) -> y[2] - x[2]);
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if(a[0][1] < b[i][2]){
                h -= b[i][2];
                ans++;
            }else if(a[0][1] > b[i][2]){
                break;
            }
            if(h <= 0)break;
        }
        if(0 < h){
            ans += (int)Math.ceil((double)h / (double)a[0][1]);
        }
        System.out.println(ans);
        sc.close();

    }

}


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

int N;
string S;

int main(void) {
	cin >> N >> S;
	S = S + "@";

	int ans = 0;
	int p = 0;
	while (true) {
		if (S[p] != S[p + 1])
			++ans;
		if (S[p + 1] == '@')
			break;
		++p;
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  string s; cin >>s;
  ll n=s.size();
  ll k; cin >>k;
  vector<ll>  v;
  vector<ll>  v2;
  ll key=1;
  ll ans=0;
  if(n==1){
    cout <<k/2<<endl;
    return 0;
  }
  rep2(i,1,n){
    if(s[i]==s[i-1]){
      key++;
      if(i==n-1){
        v.push_back(key/2);
        v2.push_back(key);
      }
    }else{
      v.push_back(key/2);
      v2.push_back(key);
      key=1;
    }
  }
  rep(i,v.size()){
    ans+=v[i];
  }
  ans*=k;
  set<char> st;
  rep(i,n)st.insert(s[i]);
  if(st.size()==1){
    cout<<(s.size()*k)/2<<endl;
    return 0;
  }
  if(s[0]==s[n-1]&&n>=3){
    if(v2[0]%2==1&&v2[v2.size()-1]%2==1){
      ans+=k-1;
    }
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
 
class Program
{
    static int[] dimention;
    static int[,] numOfMulti;
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        dimention = new int[n + 1];
        numOfMulti = new int[n, n];
        for (int i = 0; i < n; i++)
        {
            int[] inputs = Console.ReadLine().Split(' ')
                                        .Select(val => int.Parse(val))
                                        .ToArray();
            if(i == 0) dimention[0] = inputs.First();
            dimention[i + 1] = inputs.Last();
        }
        //Console.Error.WriteLine(string.Join(" ", dimention));
        Console.WriteLine(NumberOfMultiplication(0, n - 1));
    }

    
    static int NumberOfMultiplication(int i, int j)
    {
        //Console.Error.Write("i = {0}, j = {1}: ", i, j);
        if(i == j) return 0;
        if(numOfMulti[i, j] != 0) return numOfMulti[i, j];
        if(i + 1 == j) return numOfMulti[i, j] = dimention[i] * dimention[j] * dimention[j + 1];
        numOfMulti[i, j] = Enumerable.Range(i, j - i)
                                            .Select(k => NumberOfMultiplication(i, k) 
                                              + NumberOfMultiplication(k + 1, j) 
                                              + dimention[i] * dimention[k + 1] * dimention[j + 1])
                                            .Min();
        //Console.WriteLine("numOfMulti[{0}, {1}] = {2}", i, j, numOfMulti[i, j]);
        return numOfMulti[i, j];
    }
}

Measured memory_bytes: 9920
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

int main(){
	char s[4];
	scanf("%s", s);
	if(s[0] == 'S'){
		if(s[1] == 'U') printf("7\n");
		else printf("1\n");
	}
	else if(s[0] == 'M') printf("6\n");
	else if(s[0] == 'T'){
		if(s[1] == 'U') printf("5\n");
		else printf("3\n");
	}
	else if(s[0] == 'W') printf("4\n");
	else if(s[0] == 'F') printf("2\n");
	

	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args){
		String s = sc.next();
		int ans = 0;
		for(int i = 0 ; i < 4 ; i++){
			if(s.charAt(i) == '+')
				ans++;
			else
				ans--;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
from collections import deque
def bfs(graph,N):
   que=deque([0])
   visited=[0]*N
   visited[0]=1
   while que:
      node=que.popleft()
      for i in graph[node]:
         if not visited[i]:
            visited[i]=node+1
            que.append(i)
   return visited
N,M= list(map(int,input().split()))
l=[[] for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
ans=bfs(l,N)[1:]
if all(ans):
   print("Yes")
   print(*ans,sep="\n")
else:
   print("No")

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

int min(int a,int b){

    if(a>=b){return b;}
    return a;
}


int main(void){
int n,m,x,a[105];
int low=0,high=0;
scanf("%d %d %d",&n,&m,&x);
for(int i=0;i<m;i++){
    scanf("%d",&a[i]);
}

for(int i=0;i<m;i++){
    if(x>a[i]){low++;}
    else{high++;}
}
printf("%d\n",min(low,high));
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  pair<pair<string, int>, int> p[110];
  int n;
  cin >> n;
  rep(i, n) {
    string s;
    int pnt;
    cin >> s >> pnt;
    pnt=pnt*(-1);
    
    p[i]=make_pair(make_pair(s, pnt), i);
  }
  sort(p, p+n);
  rep(i, n) cout << p[i].second+1 << endl;    
}


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

int main(){
    int num[3], five=0, seven=0;
    cin >> num[0] >> num[1] >> num[2];

    for(int i=0; i<3; i++){
        if(num[i] == 5) ++five;
        else if(num[i] == 7) ++seven;
    }

    if(five == 2 && seven == 1) cout << "YES";
    else cout << "NO";

    return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
INF = float('inf')
dp = [INF] * n 
dp[0] = 0
dp[1] = abs(h[1] - h[0])

def chmin(a, b):
    if a <= b:
        return a
    else:
        return b 
    

for i in range(2, n):

    dp[i] = chmin(dp[i], dp[i - 2] + abs(h[i - 2] - h[i]))
    dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i - 1] - h[i]))
    
print(dp[n - 1])




Measured memory_bytes: 13928
#include <iostream>

using namespace std;
int main() {
	int N;
	cin >> N;

	int c = N / 1.08;
	
	c--;

	for (int i = 0; i < 10; i++) {
		//cout << "c:" << c << " :" << c * 1.08 << endl;
		if ((int)(c * 1.08) == N) {
			cout << c << endl;
			return 0;
		}
		c++;
	}

	cout << ":(" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.1416
///#define f(i,l,r) for(int i=l;i<=r;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{

   ll int i,j,k,sum=0,x,n,p=0,q,r,a,b,c;


    cin>>n>>a>>b;

    for(i=a;i<=b;i++)
    {
        if(i%n==0){
                p=1;
        break;

        }


    }

if(p==1)
    cout<<"OK"<<endl;
else
    cout<<"NG"<<endl;



return 0;

}


Measured memory_bytes: 3644
#define ENABLE_DEBUG 1
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#if ENABLE_DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                \
  do {                            \
    cerr << " \033[33m (L";       \
    cerr << __LINE__ << ") ";     \
    cerr << #__VA_ARGS__ << ": "; \
    cerr << "\033[0m";            \
    debug(__VA_ARGS__);           \
    cerr << endl;                 \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s, t;
  getline(cin, s);
  getline(cin, t);
  int tn = t.size();

  bool unrestorable = true;
  for (int i = s.size() - 1; i >= tn - 1; --i) {
    bool matched = true;
    for (int j = 0; j < tn; ++j) {
      if (s[i - j] != '?' && s[i - j] != t[tn - 1 - j]) {
        matched = false;
        break;
      }
    }
    if (matched) {
      unrestorable = false;
      for (int j = 0; j < tn; ++j) {
        s[i - j] = t[tn - 1 - j];
      }
      break;
    }
  }
  if (unrestorable) {
    cout << "UNRESTORABLE\n";
  } else {
    REP(i, s.size()) {
      if (s[i] == '?') s[i] = 'a';
    }
    cout << s << '\n';
  }
}

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

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

	vector<int> p(n), q(n);
	for (int i = 0; i < n; i++) {
		cin >> p.at(i);
		q.at(i) = p.at(i);
	}

	sort(q.begin(), q.end());

	if (p == q) {
		cout << "YES" << endl;
		return 0;
	}

	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			swap(p.at(i), p.at(j));

			if (p == q) {
				cout << "YES" << endl;
				return 0;
			} else {
				swap(p.at(i), p.at(j));
			}
		}
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
//libraries
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//namespace
using namespace std;
using namespace __gnu_pbds;

//typedef
//typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//define
#define i(X) cin>>X;
#define o(X) cout<<X<<endl;
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define line cout<<"\n";
#define pbp(a,b) push_back(make_pair(a,b));
#define vll(A) vector<long double> A;
#define ivect(A,n,p) vector<long long> A(n,p);
#define vst(A) sort(A.begin(),A.end());
#define rvst(A) sort(A.rbegin(),A.rend());
#define forin(i,a,b) for(long long i=a;i<=b;i++)
#define forde(i,a,b) for(long long i=a;i>=b;i--)
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const long long inf=(long long)1e18;
const long long mod=(long long)(1e9+7);

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll a,ll p)
{
   return power(a,p-2,p);
}

int main()
{
    // #ifndef ONLINE_JUDGE
    //    freopen ("input.txt" , "r" , stdin);
	// 	// freopen ("OUTPUT.txt" , "w" , stdout);
	// #endif
    fio;
    ll testcase=1;
    //i(testcase);
    while(testcase--)
    {
        ll x,n;
        i(x);i(n);
        ll a[102]={0};
        ll ans=1e10;
        ll y;
        while(n--)
        {
            ll p;
            i(p);
            a[p]++;
        }
        for(ll i=0;i<=101;i++)
        {
            if(!a[i])
            {
                if(abs(x-i)<ans)
                {
                    ans=abs(x-i);
                    y=i;
                }
            }
        }
        o(y);
    }
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<list>
#include<algorithm>
using namespace std;

int N;
list<int> E[100005];
int visited[100005];
vector<int> dfs_out;

void dfs(int u) {
  visited[u] = true;
  for (auto it = E[u].begin(); it != E[u].end(); it++) {
    if (!visited[*it]) {
      dfs(*it);
    }
  }
  dfs_out.push_back(u);
}

int main() {
  int M; cin >> N >> M;
  int x, y;
  for (int i = 0; i < M; i++) {
    cin >> x >> y; x--; y--;
    E[x].push_back(y);
  }
  for (int i = 0; i < N; i++) {
    if (!visited[i]) dfs(i);
  }
  int dp[N]; for (int i = 0; i < N; i++) dp[i] = 0;
  for (int i = 0; i < N; i++) {
    int u = dfs_out[i];
    for (auto it = E[u].begin(); it != E[u].end(); it++) {
      dp[u] = max(dp[u], dp[*it] + 1);
    }
  }
  cout << *max_element(dp, dp+N) << endl;
}

Measured memory_bytes: 11892
#include<iostream>

using namespace std;

int main(){
     long long n,a,b;     
     cin >> n >> a >> b;
     if(a==0){
         cout << 0 <<endl;
     }else{
         long long x = n/(a+b);
         long long y = x*a;
         long long z = n%(a+b);
         long long  j;
         if(z>=a){
             j = a;
             }else{
                 j = z;
             }
             long long  ans = y+j;
             cout << ans << endl;
     }
     return 0;
}

Measured memory_bytes: 256
import itertools
import numpy as np

N,M,Q=list(map(int,input().split()))
trains=[[0 for _ in range(N)] for _ in range(N)]

for _ in range(M):
    L,R=list(map(int,input().split()))
    trains[N-L][R-1]+=1
trains=np.array(trains)
for i in range(N):
    trains[i]=np.array(list(itertools.accumulate(trains[i])))
for i in range(N):
    trains[:,i]=np.array(list(itertools.accumulate(trains[:,i])))

for _ in range(Q):
    p,q=list(map(int,input().split()))
    print(trains[N-p,q-1])

Measured memory_bytes: 18980
#include <iostream>
#include <string>
#define LONG_INF 10000000000000000
#define REP(i,N) for(int (i) = 0; (i) < (N); i++)

using namespace std;

int main(void){
	int a,b;
	int x,ans=0,i;

	cin >> a >> b;

	x = b-a;

	for(int i=1;i<=x;i++) ans+=i;

	cout << ans-b << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool isPalindrome(string s){
    string t=s;
    reverse(t.begin(),t.end());
    return s==t;
}
int main(){
    string s;
    cin>>s;
    bool ans=true;
    if(!isPalindrome(s))ans=false;
    if(!isPalindrome(s.substr(0,s.size()/2)))ans=false;
    cout<<(ans?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
N, M = gets.split.map(&:to_i)
ABCs = readlines.map{|l| a, b, c = l.split.map(&:to_i); [a - 1, b - 1, c]}

d = N.times.map{N.times.map{100000}}
N.times{|i| d[i][i] = 0}
ABCs.each{|a, b, c| d[a][b] = d[b][a] = c}
N.times do |i|
  N.times do |j|
    N.times do |k|
      d[j][k]=[d[j][k], d[j][i]+d[i][k]].min
    end
  end
end
puts ABCs.count{|(a,b,c)| d[a][b] < c}


Measured memory_bytes: 2172
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

int main(){
  int a,b;cin>>a>>b;
  if(a<10&&b<10){
    cout<<a*b<<endl;
  }else{
    cout<<-1<<endl;
  }
}

Measured memory_bytes: 256
import  java.util.*;


import static java.util.Arrays.*;

public class Main {
    public static void main(String[] args)
    {
        Scanner sc =new Scanner(System.in);
        int a,b;
        a=sc.nextInt();
        b=sc.nextInt();
        int ar[] = new int[a];
        int i, j = 0;
        for (i = 0; i < a; i++) {
            ar[i] = sc.nextInt();
        }
        if(b>=a){
            System.out.println("0");
        }
        else {

            sort(ar);
        
            long  sum = 0;
            for (i = 0; i <a-b; i++) {
                sum = sum + ar[i];
            }

            System.out.println(sum);
        }
    }
}

Measured memory_bytes: 65292
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll a, v, b, w, t;

    cin >> a >> v >> b >> w >> t;

    if(v<=w) cout << "NO" << endl;

    else{
        ld d;
        d = (ld)abs(a-b)/(v-w);
        if(d<=t) cout << "YES" << endl;
        else cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3672
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  cin >> a;
  set<int> x, y;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      if (a[i][j] == '#') {
        x.emplace(j);
        y.emplace(i);
      }
    }
  }
  for (int i = 0; i < h; ++i) {
    if (!y.count(i)) continue;
    for (int j = 0; j < w; ++j) {
      if (!x.count(j)) continue;
      cout << a[i][j];
    }
    cout << endl;
  }
}



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#define INF 100000000
#include<vector>
#include<queue>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int> q;
typedef pair<double,q> P;//vAêA`P
/*struct edge{
	int to,cost;
};
*/
int main(){
	int a,b,n,m,p,x,y,z,t[15];
	while(cin>>n>>m>>p>>a>>b,n||m||p||a||b){
		priority_queue<P,vector<P>,greater<P> > que;
		a--;double d[1<<8][31];
		int vis[1<<8][31];//`PAê
		b--;//vector<edge> v[40];
		int v[31][31];
		for(int i=0;i<m;i++)
		fill(v[i],v[i]+m,INF);
		memset(vis,-1,sizeof(vis));
		rep(i,n)
			cin>>t[i];
		rep(i,p){
			cin>>x>>y>>z;
			x--;
			y--;
			if(v[x][y]>z)
				v[x][y]=z;
			if(v[y][x]>z)
				v[y][x]=z;
		}
		rep(i,1<<n)
		rep(j,m){
			if(j==a)
			d[i][j]=0;
			else
			d[i][j]=INF;
		}
		que.push(P(0,q(a,0)));
		int now,tic;
		P e;
		double sum;
		while(!que.empty()){
			e=que.top();
			que.pop();
			now=e.second.first;
			sum=e.first;
			tic=e.second.second;
			if(d[tic][now]<sum||vis[tic][now]!=-1){
				continue;
			}
			vis[tic][now]=1;
			if(now==b)
				break;
			d[tic][now]=sum;
			rep(i,m){
				int w=v[now][i];
				if(w==INF)
					continue;
				
				//edge w=v[now][i];
				rep(j,n){
					if(!(tic&(1<<j))){
						if(d[tic|(1<<j)][i]>sum+(double)w/t[j]){
							d[tic|(1<<j)][i]=sum+(double)w/t[j];
							que.push(P(d[tic|(1<<j)][i],q(i,tic|(1<<j))));
						}
					}
				}
			}
		}
		double ans=INF;
		rep(i,1<<n)
			ans=min(ans,d[i][b]);
		if(ans==INF)
		cout<<"Impossible"<<endl;
		else
		printf("%.3lf\n",ans);
		//rep(i,m)
		//v[i].clear();
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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


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

    int N;
    string S;
    cin >> N >> S;

    stack<int> sta;

    for(int i = 0; i < N; i++){
        if(S[i] == '('){
            sta.push(0);
        }else{// S[i] == ')' sta.top()が0なら閉じられる!
            if((sta.empty() == 0) && (sta.top() == 0)){
                sta.pop();
            }else{
                sta.push(1);
            }
        }
    }

    int n_left, n_right;
    n_left = 0; n_right = 0;
    while(!sta.empty()){
        if(sta.top() == 0){
            n_left++;
        }else{
            n_right++;
        }
        sta.pop();
    }

    // cout << n_left << " " << n_right << endl;

    // n_rightの分だけ左に'('を足す
    for(int i = 0; i < n_right; i++){
        S = "(" + S;
    }

    for(int i = 0; i < n_left; i++){
        S = S + ")";
    }

    cout << S << endl;
    return 0;
}



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

int main() {

  int N;
  cin >> N;
  int n = 0;
  //nは２で割れる回数
  
  	for (int i = 0; i < N; i++){
      int x;
      cin >> x;
      int sub = 0;//subは入力された数単体が２で割れる回数
	   	
      for (int j = 0; ; j++){
          if ( x % 2 ==0){
            sub ++;
            x /=2;
          }
          else 
            break;
    	}
      
      if(i == 0)
        n = sub;//１回目

      else if(n > sub)
        n = sub;//２回目以降；nを小さい方に書き換え

    }//ここまでfor文
   cout << n << endl;
}

Measured memory_bytes: 3592
//daddy's back in town, back to rolling the damn hash yoooo babeeeeees//
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define x first
#define y second
#define pi pair <int, int>
#define vi vector <int>
#define L nod<<1
#define R ((nod<<1)|1)
#define int ll
const ll mod = 998244353;
int n, k, a[200020], ans;
map<int, int> mp;

int32_t main(){
	ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	cin>>n>>k;
	for(int i=1; i<=n; i++) cin>>a[i], a[i]+=a[i-1];
	for(int i=1; i<=n; i++) a[i]=((a[i]-i)%k+k)%k;
	//for(int i=0; i<=n; i++) cout<<a[i]<<" "; cout<<endl;
	for(int i=0; i<min(k, n+1); i++) mp[a[i]]++;
	for(int i=0; i<n; i++){
		mp[a[i]]--;
		ans+=mp[a[i]];
		//cout<<mp[a[i]]<<endl;
		if(i<=n-k) mp[a[i+k]]++;
	}
	cout<<ans;
}


Measured memory_bytes: 14336
#include <stdio.h>
#include <string.h>

int main(void)
{

  char s[100000];
  int  n, i, a, p=0, q=0;
  scanf("%s",s);
  n=strlen(s);
  for(i=0;i<n;i++){
        if(s[i]=='0') p++;
        else if(s[i]=='1') q++;
  }
  a=0;
  if(q<p) a=q*2;
  else  a=p*2;
  printf("%d\n",a);
  return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
use itertools::Itertools;
use proconio::{input, marker::*};
use std::cmp::*;
use std::collections::*;
use superslice::*;

fn main() {
    input! {
        n: usize,
    }

    let mut graph: Vec<Vec<usize>> = vec![vec![]; n + 1];
    let mut count = 0;

    for i in 1..n {
        for j in i + 1..=n {
            if n % 2 == 0 && i + j == n + 1 {
                continue;
            } else if n % 2 == 1 && i + j == n {
                continue;
            }
            graph[i].push(j);
            count += 1;
        }
    }

    println!("{}", count);
    for i in 1..=n {
        for &j in &graph[i] {
            println!("{} {}", i, j);
        }
    }
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define fo(i, u, v) for(int i= u; i<=v; ++i)
#define fob(i, u, v) for(int i = u; i>=v; --i)
#define f1(i, u) for(int i = 1; i<=u; ++i)
#define f0(i, u) for(int i = 0; i<=u; ++i)
#define fi first
#define se second
#define si size()
#define name ""

using namespace std;
typedef long long ll;
typedef pair <int ,int> ii;
typedef pair <ll, ll> lii;
typedef vector <int> vi;
typedef vector <long long> vll;
const long long MOD = 1e9 +7;
const long long N = 1e6 + 7;

int getbit(ll x, int y) { return (x >> (y-1)) &1; }
void Off_bit(ll &x , ll y) { x = x & (~(1<<y)); }

int n, a[N], res, ma;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(name".inp","r", stdin);
    //freopen(name".out","w", stdout);
	cin>>n;
	fo(i, 1, n) {
		int x; cin>>x;
		a[x]++;
		if(x > 0) a[x-1]++;
		a[x+1]++;
		ma = max(ma, x);
	}
	fo(i, 1, ma+1) res = max(res, a[i]);
	cout<<res;
    return 0;
}


Measured memory_bytes: 640
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int k;
  cin>>k;
  
  int a=0;
  int ans=-1;
  for(int i=1;i<=k+1;i++){
    a=10*a+7;
    if(a%k==0){
      ans=i;
      break;
    }
    a=a%k;
  }
  
  cout<<ans<<endl;

  return 0;
}

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

int main(){
  int n;
  cin>>n;
  string s[n];
  for(int i=0;i<n;i++){
    cin>>s[i];
  }
  map<string,int> m;
  for(int i=0;i<n;i++){
    m[s[i]]++;
  }
  cout<<"AC x "<<m["AC"]<<endl;
  cout<<"WA x "<<m["WA"]<<endl;
  cout<<"TLE x "<<m["TLE"]<<endl;
  cout<<"RE x "<<m["RE"]<<endl;
}


Measured memory_bytes: 6720
n = gets.chomp.to_i
takoyaki = gets.chomp.split(' ').map!(&:to_i)
sum =0
(0..n-1).each do |a|
    (a+1..n-1).each do |b|
      sum = sum + takoyaki[a]*takoyaki[b]
    end
end
puts sum

Measured memory_bytes: 1788
#include<stdio.h>
int main()
{
    int a,b,c;
scanf("%d %d %d",&a,&b,&c);

 if(a==b && b==c)
    printf("1\n");

 else if(a==b && b!=c)
    printf("2\n");

    else if(a==c && b!=a)
    printf("2\n");

    else if(c==b && a!=c)
    printf("2\n");



 else printf("3\n");


 return 0;

}


Measured memory_bytes: 128
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


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

def main():
    N, T = map(int, input().split())
    best = INF
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            best = min(best, c)

    if best == INF:
        print("TLE")
    else:
        print(best)

if __name__ == '__main__':
    main()


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

int main(){

  int A,B;
  cin>>A>>B;
  
  int count=0;
  
  B-=1;
  while(B>0){

    B-=(A-1);
    count++;

  }
  cout<<count;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
cin>>a>>b;
if((a.size())>(b.size()))cout<<"GREATER";
else if((a.size())<(b.size()))cout<<"LESS";
else {
    for(int i=0;i<a.size();i++){
        if(a[i]>b[i]){
            cout<<"GREATER";
            return 0;
        }
        if(a[i]<b[i]){
            cout<<"LESS";
            return 0;
        }
    }
    cout<<"EQUAL";
}
return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int main() {
  string S; cin >> S;
  map<char, int> T;
  for (int i = 0; i < 4; i++) {
    T[S[i]]++;
  }

  if (T.size() == 2) {
    bool b = true;
    for (auto x: T) {
      b &= (x.second == 2);
    }
    if (b == true) {
      cout << "Yes" << endl;
      return 0;
    } 
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

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

    //作る時はparentsを-1で初期化する
    //こうすることで全部ばらばらになる
    UnionFind(int n){
        parents = vector<int>(n, -1);
    }

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

    //自分のいるグループの大きさを調べる
    int size(int A){
        return -parents[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接ではなく親同士をくっつける
        A=root(A);
        B=root(B);
        if(A==B){
            return false;
        }

        //大きい方（A)に小さい方（B)をくっつけたい
        if(size(A)<size(B)) swap(A, B);

        parents[A] += parents[B];
        parents[B] = A;

        return true;
    }
};


int main(){
    ll N, M; cin >> N >> M;
    vector<int> a(M), b(M);
    for(int i=0; i<M; ++i) cin >> a[i] >> b[i];

    UnionFind uni(N+1);
    vector<ll> ans(M, N*(N-1)/2);
    for(int i=M-1; i>0; --i){
        int x = a[i], y = b[i];
        if(uni.root(x) == uni.root(y)) ans[i-1] = ans[i];
        else{
            ans[i-1] = ans[i] - (ll)uni.size(x)*uni.size(y);
            uni.connect(x, y);
        }
    }

    for(int i=0; i<M; ++i) cout << ans[i] << endl;
}

Measured memory_bytes: 3328
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int A, B, X;
int main() {
	cin >> X >> A >> B;
	X -= A;
	cout << X % B << endl;
	return 0;
}

Measured memory_bytes: 256