akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <functional>

using namespace std;

/*-------------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(a)					(a).begin(),(a).end()
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						(1000 * 1000 * 1000 * 2)
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
ll execOne(const vector<ll> &a)
{
	ll sum = 0;
	ll ans = 0;
	for (int i = 0; i < a.size();) {
		sum += a[i];
		if (0 <= sum) {
			ans += (abs(sum) + 1);
			sum = -1;
		}
		i++;
		if (i == a.size()) {
			break;
		}

		sum += a[i];
		if (0 >= sum) {
			ans += (abs(sum) + 1);
			sum = 1;
		}
		i++;
	}

	return ans;
}

ll execOneRev(const vector<ll> &a)
{
	ll sum = 0;
	ll ans = 0;
	for (int i = 0; i < a.size();) {
		sum += a[i];
		if (0 >= sum) {
			ans += (abs(sum) + 1);
			sum = 1;
		}
		i++;
		if (i == a.size()) {
			break;
		}
		
		sum += a[i];
		if (0 <= sum) {
			ans += (abs(sum) + 1);
			sum = -1;
		}
		i++;
	}

	return ans;
}

// メイン
int main()
{
	ll n;
	cin >> n;
	vector<ll> a(n);
	REP(i, n) {
		cin >> a[i];
	}

	ll ans1 = execOne(a);
	ll ans2 = execOneRev(a);
	cout << min(ans1, ans2) << endl;
	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int H, W;
bool used[410][410];
string S[410];

typedef pair<int, int> P;
P dfs(int x, int y) {
    used[x][y] = true;
    P cnt = {0, 0};
    if(S[x][y] == '#') cnt.first++;
    else cnt.second++;

    rep(i, 4) {
        int xx = x + dx[i];
        int yy = y + dy[i];
        if (xx < 0 || xx >= H || yy < 0 || yy >= W) continue;
        if(used[xx][yy]) continue;
        if(S[x][y] == S[xx][yy]) continue;
        P tmp = dfs(xx, yy);
        cnt.first += tmp.first;
        cnt.second += tmp.second;
    }
    return cnt;
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    cin >> H >> W;
    rep(i, H) cin >> S[i];
    ll ans = 0;
    rep(i, H) {
        rep(j, W) {
            P cnt;
            if(!used[i][j] &&  S[i][j] == '#') cnt = dfs(i, j);
            ans += (ll)cnt.first * cnt.second;
            
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 20608
c = []
3.times do
  c.push gets.chomp.split().map(&:to_i)
end

x = Array.new(3)
y = Array.new(3)

x[0] = 0
3.times do |i|
  y[i] = c[i][0]
end
3.times do |i|
  x[i] = c[0][i] - y[0]
end


1.upto(2).each do |i|
  1.upto(2).each do |j|
    if c[i][j] != y[i] + x[j]
      puts 'No'
      exit
    end
  end
end


puts 'Yes'


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

using namespace std;

int gcd(int a, int b) {
        if (a < b) {
                swap(a, b);
        }
        if (b == 0) return a;
        return gcd(b, a % b);
}

int main() {
        int N;
        cin >> N;
        vector<int> as(N);
        for(int i = 0; i < N ; i++) {
                cin >> as[i];
        }
        vector<int> left(N);
        vector<int> right(N);
        left[0] = 0;
        right[N-1] = 0;
        for(int i = 1; i< N; i++) {
                left[i] = gcd(left[i-1], as[i-1]);
        };
        for( int i = N - 2; i >= 0; i--) {
                right[i] = gcd(right[i+1], as[i+1]);
                }
        /*
        for(int i = 1; i < N; i++) {
                left[i] = gcd(left[i-1], as[i-1]);
                right[N-1-i] = gcd(right[N-i], as[N-i]);
        }
        */
        int m = 1;
        int mm;
        for(int i = 0 ; i < N; i++) {
                mm = gcd(left[i], right[i]);
                if (mm > m) {
                        m = mm;
                }
        }
        cout << m << endl;
        return 0;
}


Measured memory_bytes: 1408
class Disjointset:

    def __init__(self,n):
        self.rank = [0]*n
        self.p = [i for i in range(n)]

    def same(self,x,y): return self.findSet(x) == self.findSet(y)

    def unite(self,x,y): return self.link(self.findSet(x), self.findSet(y))

    def link(self,x,y):
        if self.rank[x] > self.rank[y]: self.p[y] = x
        else:
            self.p[x] = y
            if self.rank[x] == self.rank[y]: self.rank[y] += 1

    def findSet(self,x):
        if x != self.p[x]: self.p[x] = self.findSet(self.p[x])
        return self.p[x]

n,q = map(int,input().split())
ds = Disjointset(n)
ans = []
for _ in range(q): 
    com,x,y = map(int,input().split())
    if com == 0: ds.unite(x,y)
    else: ans.append("1" if ds.same(x,y) else "0")
print("\n".join(ans))


Measured memory_bytes: 6672
#skip
n,x=map(int,input().split())
lists=list(map(int,input().split()))
for i in range(n):
    lists[i]=abs(lists[i]-x)
from fractions import gcd
A=lists[0]
for i in range(1,n):
    A=gcd(A,lists[i])
print(A)

Measured memory_bytes: 14252
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define _D(p) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p)<<std::endl;
#define _D2(p,q) std::cout<<"L"<<__LINE__<<" : " #p " = "<<(p) << ", " #q " = "<<(q)<<std::endl;
#define _DN(v) std::cout<<"L"<<__LINE__<<" : " #v " = ["; rep(i,(v).size()) {std::cout<<v[i]<<(i==v.size()-1?"":", ");}std::cout<<"]"<<std::endl;
#define _DNN(v) std::cout<<"L"<<__LINE__<<" : " #v " = [" << std::endl; rep(i,(v).size()) {std::cout<<"	[";rep(j,(v)[0].size()){std::cout<<v[i][j]<<(j==v[0].size()-1?"":", ");}std::cout<<"],"<<std::endl;}std::cout<<"]"<<std::endl;
 
using namespace std;
 
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
 
const int INF=1<<29;
const double EPS=1e-9;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

struct Team
{
	Team():
	ac(0), pena(0)
	{
		for (int i = 0; i < 10; ++i) {
			tried[i] = 0;
		}
	}

	int id;
	int ac;
	int pena;
	int tried[10];
};
int main(int argc, char const *argv[]) {
	int T, P, R;

	while(cin >> T >> P >> R)
	{
		if(T == 0 && P == 0 && R == 0) break;

		vector<Team> teams(T);

		for(int i = 0; i < T; ++i)
		{
			teams[i].id = i + 1;
		}

		for (int i = 0; i < R; ++i) {
					int tID;
					int pID;
					int itime;
					string str;
					cin >> tID >> pID >> itime >> str;
					tID--;
					pID--;
					if(str == "CORRECT")
					{
						teams[tID].ac++;
						teams[tID].pena += teams[tID].tried[pID] * 1200 + itime; 
					}
					else
					{
						teams[tID].tried[pID]++;
					}
				}

		stable_sort(all(teams), [](Team a, Team b){return a.pena < b.pena;});
		stable_sort(all(teams), [](Team a, Team b){return a.ac > b.ac;});

		for(auto e : teams)
		{
			cout << e.id << ' ' << e.ac << ' ' << e.pena << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    string str, q, rep;
    int m, n, s, t;
    cin >> str;
    cin >> n;
    for(int i=0;i<n;i++) {
        s = 0;
        t = 0;
        cin >> q;
        if (q == "replace") {
            m = 1;
        } else if (q == "reverse") {
            m = 2;
        } else {
            m = 3;
        }
        switch(m) {
            case 1:
                cin >> s >> t;
                cin >> rep;
                for(int j=0;j<t-s+1;j++) {
                    str[s+j] = rep[j];
                }
                break;
            case 2:
                cin >> s >> t;
                rep = str;
                for(int j=0;j<t-s+1;j++) {
                    str[s+j] = rep[t-j];
                }
                break;
            case 3:
                cin >> s >> t;
                for(int j=0;j<t-s+1;j++) {
                    cout << str[s+j];
                }
                cout << endl;
                break;
        }
    }
}

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

typedef long long ll;
using namespace std;

int main(){
	string s;
	cin >> s;
	vector <int> a,b;
	for(int i=0; i< s.size(); i++){
		int t = (i%2 == 0) ? 1 : 0;
		a.push_back(t);
		b.push_back((t == 1)? 0 : 1);
	}
	int m1=0, m2=0;

	for(int i=0;  i <s.size(); i++){
		int c;
		c = (s[i] == '1')? 1:0;
		if(a[i] != c){
			m1++;
		}
		if(b[i] != c){
			m2++;
		}
	}
	cout << min(m1,m2);
	return 0;
}

Measured memory_bytes: 1404
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc119d
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = ReadIntList();
            double N = NK[0];
            double K = NK[1];
            var ans = 0.0;

            for (int i = 1; i <= N; i++)
            {
                var p = i;
                var j = 0;

                if (i >= K)
                {
                    ans += 1.0/N;
                    continue;
                }

                while (p < K)
                {
                    p *= 2;
                    j++;
                }
                ans += Math.Pow(0.5, j)/N;
            }

            Console.WriteLine(ans);
#if DEBUG
            Console.ReadKey();
#endif
        }

        private static bool IsRange(int a, int from, int to) => (from <= a && a <= to);
        private static int ReadInt() => int.Parse(Console.ReadLine());
        private static List<int> ReadIntList() => Console.ReadLine().Split().Select(int.Parse).ToList();
        private static double ReadDouble() => double.Parse(Console.ReadLine());
        private static List<double> ReadDoubleList() => Console.ReadLine().Split().Select(double.Parse).ToList();
        private static long ReadLong() => long.Parse(Console.ReadLine());
        private static List<long> ReadLongList() => Console.ReadLine().Split().Select(long.Parse).ToList();
        private static List<int> Int2Digits(int a) => a.ToString().ToCharArray().Select(_ => int.Parse(_.ToString())).ToList();
        private static int BinarySearch<Type>(IReadOnlyList<Type> s, Type target) // target 以下の最大要素のインデックスを返す
            where Type : IComparable
        {
            var lower = 0;
            var upper = s.Count - 1;
            while (upper - lower > 1)
            {
                var mid = lower + (upper - lower) / 2;
                if (s[mid].CompareTo(target) <= 0)
                {
                    lower = mid;
                }
                else
                {
                    upper = mid;
                }

            }
            return lower;
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <map>
#include <vector>
#include <cassert>
#include <algorithm>
using namespace std;
 
int N, X[1 << 18], Y[1 << 18];
char D[1 << 18];
 
void Rotate() {
	for (int i = 1; i <= N; i++) {
		int cx = Y[i], cy = 200000 - X[i], cz;
		if (D[i] == 'U') cz = 'R';
		if (D[i] == 'R') cz = 'D';
		if (D[i] == 'D') cz = 'L';
		if (D[i] == 'L') cz = 'U';
		X[i] = cx; Y[i] = cy; D[i] = cz;
	}
}
 
vector<pair<int, char>> V1[1 << 19];
vector<pair<int, char>> V2[1 << 19];
 
int solve_01() {
	int Answer = (1 << 24);
	for (int i = 0; i <= 500000; i++) V1[i].clear();
	for (int i = 1; i <= N; i++) {
		if (!(D[i] == 'R' || D[i] == 'U')) continue;
		V1[X[i] + Y[i]].push_back(make_pair(X[i], D[i]));
	}
	for (int i = 0; i <= 500000; i++) {
		sort(V1[i].begin(), V1[i].end());
		for (int j = 0; j < (int)V1[i].size() - 1; j++) {
			if (!(V1[i][j].second == 'R' && V1[i][j + 1].second == 'U')) continue;
			Answer = min(Answer, V1[i][j + 1].first - V1[i][j].first);
		}
	}
	return Answer * 10;
}
 
int solve_02() {
	int Answer = (1 << 24);
	for (int i = 0; i <= 500000; i++) V2[i].clear();
	for (int i = 1; i <= N; i++) {
		if (!(D[i] == 'L' || D[i] == 'R')) continue;
		V2[Y[i]].push_back(make_pair(X[i], D[i]));
	}
	for (int i = 0; i <= 500000; i++) {
		sort(V2[i].begin(), V2[i].end());
		for (int j = 0; j < (int)V2[i].size() - 1; j++) {
			if (!(V2[i][j].second == 'R' && V2[i][j + 1].second == 'L')) continue;
			Answer = min(Answer, V2[i][j + 1].first - V2[i][j].first);
		}
	}
	return Answer * 5;
}
 
map<pair<int, int>, int>Map;
 
int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> X[i] >> Y[i] >> D[i];
 
	// 制約チェック
	assert(1 <= N && N <= 200000);
	for (int i = 1; i <= N; i++) {
		assert(0 <= X[i] && X[i] <= 200000);
		assert(0 <= Y[i] && Y[i] <= 200000);
		assert(D[i] == 'U' || D[i] == 'D' || D[i] == 'L' || D[i] == 'R');
		assert(Map[make_pair(X[i], Y[i])] == 0);
		Map[make_pair(X[i], Y[i])] = 1;
	}
 
	int FinalAns = (1 << 24);
	for (int t = 1; t <= 4; t++) {
		int val1 = solve_01(); FinalAns = min(FinalAns, val1);
		int val2 = solve_02(); FinalAns = min(FinalAns, val2);
		Rotate();
	}
	if (FinalAns == (1 << 24)) cout << "SAFE" << endl;
	else cout << FinalAns << endl;
	return 0;
}

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

int main() {
  int a, b, h;
  cin >> a >> b >> h;
  cout << (a+b)*h/2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
int cnt[5],a[100010];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",a+i);
		if(a[i]%4==0){
			cnt[4]++;
		}else if(a[i]%2!=0) cnt[0]++;
		else cnt[2]++;
	}
	if(cnt[0]>cnt[4]){
		if(cnt[0]-1==cnt[4] && cnt[2]==0) puts("Yes");
		else
			puts("No");
	}else puts("Yes");
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
pair<int, int> a[1010];
int w[30300];
int main(){
    int h, n, ans = 0;
    cin >> h >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i].first >> a[i].second;
    }
    for(int i = h-1; i >= 0; i--){
        w[i] = INT_MAX;
        for(int j = 0; j < n; j++){
            if(w[i] > w[i+a[j].first] + a[j].second)    w[i] = w[i+a[j].first] + a[j].second;
        }
    }
    cout << w[0] << '\n';
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
		//		new Main().solveB();
		new Main().solveB2();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();
			lineBC = scanner.nextInt();
			lineCA = scanner.nextInt();

			if (lineCA <= (lineAB + lineBC)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int n = 0;
		int m = 0;

		try {
			scanner = new Scanner(System.in);
			n = scanner.nextInt();

			Map<String, Integer> nArray = new HashMap<String, Integer>();
			for (int i = 0; i < n; i++) {
				String key = scanner.next();
				if (!nArray.containsKey(key)) {
					nArray.put(key, 1);
				} else {
					int count = nArray.get(key);
					nArray.put(key, ++count);
				}
			}

			m = scanner.nextInt();

			for (int i = 0; i < m; i++) {
				String key = scanner.next();
				if (nArray.containsKey(key)) {
					int count = nArray.get(key);
					nArray.put(key, --count);
				}
			}

			int maxCount = 0;
			for (Iterator<Integer> iterator = nArray.values().iterator(); iterator.hasNext();) {
				maxCount = Math.max(maxCount, iterator.next());
			}

			System.out.println(maxCount);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB2() {
		Scanner scanner = null;
		int n = 0;
		int m = 0;

		try {
			scanner = new Scanner(System.in);
			n = scanner.nextInt();

			String[] nArray = new String[n];
			for (int i = 0; i < nArray.length; i++) {
				nArray[i] = scanner.next();
			}

			m = scanner.nextInt();

			String[] mArray = new String[m];
			for (int i = 0; i < mArray.length; i++) {
				mArray[i] = scanner.next();
			}

			int result = 0;
			for (int i = 0; i < n; i++) {
				int wkRes = 0;
				for (int j = 0; j < n; j++) {
					if (nArray[i].equals(nArray[j])) {
						wkRes++;
					}
				}

				for (int j = 0; j < m; j++) {
					if (nArray[i].equals(mArray[j])) {
						wkRes--;
					}
				}
				result = Math.max(wkRes, result);

			}

			System.out.println(result);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 21332
# きりみんちゃん配信からきました
# 4で割りきれる数と奇数をぶつける（4で割り切れず2で割り切れるやつはまあはい）
n = int(input())
arr = list(map(int, input().split()))
dividable4 = 0
dividable2 = 0
odds = 0
for a in arr:
  if a % 4 == 0:
    dividable4 += 1
  elif a % 2 == 1:
    odds += 1
  elif a % 2 == 0:
    dividable2 += 1
print("Yes" if odds <= dividable4 or (odds - dividable4 == 1 and dividable2 == 0)  else "No")

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

int main(){
  int N; cin >> N;
  vector<tuple<string, int, int>> given;
  for(int i = 0; i < N; i++) {
    string name; int point; cin >> name >> point;
    given.push_back(make_tuple(name, INT_MAX - point, i + 1));
  }
  
  sort(given.begin(), given.end());
  
  for(auto x: given) cout << get<2>(x) << "\n";
  return 0;
}

Measured memory_bytes: 256
def cmb(n, r):
	if n - r < r:
		r = n - r
	if r == 0:
		return 1
	if r == 1:
		return n
	
	num = [n - r + k + 1 for k in range(r)] #numerator(分子)
	den = [k + 1 for k in range(r)] #denominator(分母)
	
	for p in range(2, r + 1):
		pivot = den[p - 1]
		if pivot > 1:
			offset = (n - r) % p
			for k in range(p - 1, r, p):
				num[k - offset] /= pivot
				den[k] /= pivot
	
	result = 1
	for k in range(r):
		if num[k] > 1:
			result *= int(num[k])
			result = result % mod
	
	return result

n,a,b = map(int,input().split())
mod = 10**9+7

print((pow(2,n,mod) - 1 - cmb(n,a) - cmb(n,b)) % mod)

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

int main(){
  long long N;
  cin>>N;
  long long h,n,w;
  for(h=N/4+1;h<=3500;h++){
    for(n=h;n<=3500;n++){
      if((4*h*n-N*(h+n)) > 0 && (N*h*n)%(4*h*n-N*(h+n))==0){
        w=(N*h*n)/(4*h*n-N*(h+n));
         cout<<h<<" "<<n<<" "<<w<<endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3552
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
    ll n, k; cin >> n >> k;
    ll arr[n];
    for(int i=1; i<=n; ++i)cin >> arr[i];
    for(int i=k+1; i<=n; ++i)
    {
        if(arr[i-k]<arr[i])cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }

return 0;
}

Measured memory_bytes: 5164
from sys import stdin
input = stdin.readline

def main():
    S = list(input())
    S.pop()
    m = 2019
    div_list = [0]*m
    num = 0
    for i, l in enumerate(reversed(S)):
        num += pow(10, i, m)*int(l)
        div_list[num%m] += 1

    div_list[0] += 1
    ans = 0
    for item in div_list:
        ans += int(item*(item-1)/2)

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 10564
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<math.h>
#include<stdlib.h>
#include<time.h>
#include<map>
#include<queue>
#include<set>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define fe(x) for(int i=be[x];i;i=e[i].ne)
using namespace std;
int a,b,c;
int main(){
	scanf("%d%d%d",&a,&b,&c);
	if (c>=a&&c<=b) printf("Yes\n");else printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n,a,b;
int main(){
	cin>>n>>a>>b;
	if(a>b)swap(a,b);
	if(a==b)puts("0");
	else if((b-a)%2==0)printf("%lld\n",(b-a)/2);
	else{
		LL ans=0;
		ans=min(n-a,b-1);
		LL b1=b;LL a1=a;
		b-=a;a=1;ans=min(ans,(b-a)/2+a1);
		a1+=(n-b1+1);LL tmp=n-b1+1;
		b1=n;ans=min(ans,(b1-a1)/2+tmp);
		cout<<ans<<endl;
	} 
}
	

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

int sum(int a)
{
    if(a==1) return 300000;
    if(a==2) return 200000;
    if(a==3) return 100000;
    return 0;

}
void solve()
{
  int x, y;
  cin>>x>>y;
  if(x==1 && y==1)
  {
     cout<< 1000000;
     return;
  }

  int res = sum(x)+sum(y);
  cout<<res<<endl;
}
int main()
{
    int t;
    t=1;
    while(t--)
    {
        solve();

    }
return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>

using namespace std;
using ll = long long int;

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

const long long MOD = 1000000007;

void solve(long long N, std::vector<long long> A){
  ll ans = 0;
  for(ll i=0; i<60; i++) {
    ll x=0;
    for(ll j=0; j<N; j++) {
      if((A[j]>>i)&1ull) x++;
    }
    ll c = x*(N-x)%MOD;
    for(ll j=0; j<i; j++)
      c = c*2%MOD;
    ans = (ans+c)%MOD;
  }
  std::cout << ans << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}



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

int main() {
  // 入力を受け取る
  string S;
  cin >> S;
  
  auto ret = count_if(S.begin(), S.end(), [](char a) { return a == 'o'; });
  
  cout << 700 + ret * 100 << endl;
}


Measured memory_bytes: 3600
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INF = 2147483647;
const double PI = 3.14159265358979323846;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main(){
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int i, n;
	cin >> n >> i;
	cout << n - i + 1 << endl;
	return 0;
}


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

constexpr int INF = 1e9;

int main() {
    int D, N; cin >> D >> N;
    vector<int> T(D), A(N), B(N), C(N);
    for(int i = 0; i < D; ++i) {
        cin >> T[i];
    }
    for(int i = 0; i < N; ++i) {
        cin >> A[i] >> B[i] >> C[i];
    }

    vector<vector<int>> dp(D + 1, vector<int>(N, -INF));
    for(int i = 0; i < D; ++i) {
        for(int j = 0; j < N; ++j) {
            if(A[j] <= T[i] && T[i] <= B[j]) {
                if(i == 0) {
                    dp[i + 1][j] = 0;
                } else {
                    for(int k = 0; k < N; ++k) {
                        dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + abs(C[j] - C[k]));
                    }
                }
            }
        }
    }

    cout << *max_element(begin(dp[D]), end(dp[D])) << endl;
}



Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define pb push_back 
#define endl '\n'
#define bug(x) cout << #x << " = " << x << '\n'
#define ll long long
map<char, int> mp;

int32_t main(){
	char ans;
	mp['a'] = 0, mp['b'] = 1, mp['c'] = 2;
	string mat[3];
	for(int i = 0; i < 3; i++)
		cin >> mat[i];
	int atu = mp['a'];
	while(true)
	{
		char c = mat[atu].front();
		mat[atu].erase(mat[atu].begin());
		atu = mp[c];
		if(mat[atu].empty())
		{ ans = toupper(c);	break; }
	}
	
	cout << ans;
}


Measured memory_bytes: 256
import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            long a = Long.parseLong(sc.next());
            long b = Long.parseLong(sc.next());
            Integer.parseInt(sc.next());
            long k = Long.parseLong(sc.next()), ret;
            
            if(k%2 == 0){
            	ret = a-b;
            }else{
            	ret = b-a;
            }
            System.out.println(ret);
            
            sc.close();
        }
    }
	

Measured memory_bytes: 23124
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
static inline void fast_io()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}
using ll = long long;
using ld = long double;

int main()
{
    fast_io();

    ll n;
    cin >> n;
    stack<char> v;
    while (n != 0) {
        v.push(((n - 1) % 26) + 'a');
        n -= 1;
        n /= 26;
    }
    while (!v.empty()) {
        cout << v.top();
        v.pop();
    }
}


Measured memory_bytes: 3136
n = 50001
is_prime = [i for i in range(n)]
is_prime[0] = is_prime[1] = 0
i = 2
while i**2 <= n:
    j = i*2
    while j < n:
        is_prime[j] = 0
        j += i
    i += 1

prime_set  = set(is_prime)
prime_set.remove(0)
prime_list = sorted(list(prime_set))

while True:
    cnt = 0
    n = int(input())
    if n == 0:
        break
    for i in prime_list:
        if i > n//2:
            break
        if n - i in prime_set:
            cnt += 1
    print(cnt)



Measured memory_bytes: 7652
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<complex>
using namespace std;
typedef long long LL;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
const int N=2005,M=100005;
int tong[N][N][2],n,k,x[M],y[M],z[M],sum[N][N][2];
inline int calc(int i,int j,int k,int l,int id){
	return sum[k][l][id]-sum[i-1][l][id]-sum[k][j-1][id]+sum[i-1][j-1][id];
}
int check(){
	int ans=0;
	for(int i=1;i<=n;i++)tong[x[i]+1][y[i]+1][z[i]]++;
	for(int i=1;i<=2*k;i++)for(int j=1;j<=2*k;j++){
		for(int l=0;l<2;l++)sum[i][j][l]=sum[i-1][j][l]+sum[i][j-1][l]-sum[i-1][j-1][l]+tong[i][j][l];
	}
	for(int i=1;i<=k;i++){
		for(int j=1;j<=k;j++){
			for(int l=0;l<2;l++){
				ans=max(ans,calc(1,1,i,j,l)+calc(i+1,j+1,i+k,j+k,l)+calc(i+k+1,j+k+1,2*k,2*k,l)+calc(i+k+1,1,2*k,j,l)+calc(1,j+k+1,i,2*k,l)+
				calc(1,1,2*k,2*k,l^1)-(calc(1,1,i,j,l^1)+calc(i+1,j+1,i+k,j+k,l^1)+calc(i+k+1,j+k+1,2*k,2*k,l^1)+calc(i+k+1,1,2*k,j,l^1)+calc(1,j+k+1,i,2*k,l^1)));
				//if(calc(1,1,i,j,l)+calc(i+1,j+1,k,k,l)+calc(i+1,1,k,j,l^1)+calc(1,j+1,i,k,l^1)==5)
				//cout<<i<<" "<<j<<" "<<l<<" "<<calc(1,1,i,j,l)<<" "<<calc(i+1,j+1,k,k,l)<<" "<<calc(i+1,1,k,j,l^1)<<" "<<calc(1,j+1,i,k,l^1)<<endl;
			}
		}
	}
	return ans;
}
int main(){
	n=read(); k=read();
	for(int i=1;i<=n;i++){
		x[i]=read()%(k*2); y[i]=read()%(k*2); z[i]=getchar()=='W';
	}
	cout<<check()<<endl;
}


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

#define debug(x) cerr<<#x<<'='<<x<<'\n'
#define Int const int &


int main(void) {
	int a, b;
	scanf("%*d");
	cin>>a>>b;
	if ((b-a)&1) {
        puts("Borys");
	} else {
		puts("Alice");
	}
	return 0;
}

Measured memory_bytes: 256
h, w = map(int, input().split())
a = [list(list(input())) for _ in range(h)]

cnt = 0
rb = [x.count('.') == w for x in a]
for i in range(len(rb)):
    if rb[i] is True:
        del a[i-cnt]
        cnt += 1
cnt = 0
cb = [x.count('.') == len(a) for x in zip(*a)]
for i in range(len(cb)):
    if cb[i] is True:
        for j in range(len(a)):
            del a[j][i-cnt]
        cnt += 1

for x in a:
    print(*x, sep='')


Measured memory_bytes: 40432
D = [-1,0,1]

def count(y,x):
    res = 0
    for dy in D:
        for dx in D:
            ny = y+dy
            nx = x+dx
            if 0 <= ny < H and 0 <= nx < W and S[ny][nx] == "#":
                res += 1
    return res
    
[H,W] = list(map(int,input().split()))
S = [input() for i in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] != "#":
            cnt = count(i,j)
            S[i] = S[i][:j] + str(cnt) + S[i][j+1:]
for i in range(H):
    print(S[i])


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

int x[333333], y[333333];
int main() {
    int h, w, m;
    cin >> h >> w >> m;
    set<pair<int, int>> s;
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        s.emplace(a, b);
        x[a]++, y[b]++;
    }
    int m1 = 0, m2 = 0;
    for(int i = 0; i < h; i++)
        m1 = max(m1, x[i + 1]);
    for(int i = 0; i < w; i++)
        m2 = max(m2, y[i + 1]);
    vector<int> z;
    for(int j = 0; j < w; j++)
        if(y[j + 1] == m2)
            z.push_back(j + 1);
    for(int i = 0; i < h; i++) {
        if(x[i + 1] < m1)
            continue;
        for(int j : z) {
            if(s.find({i + 1, j}) == s.end())
                goto pn;
        }
    }
    m1--;
pn:
    cout << m1 + m2 << endl;
    return 0;
}


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

def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

def cmb(n, r, p):
    #print(r)
    if (r < 0) or (n < r):
        return 0
    tmp = 1
    for i in range(r):
        tmp *= (n-i) % p
        tmp %= p
        tmp *= power_func(r-i,p-2,p) % p
        tmp %= p
    return tmp%p
    #r = min(r, n - r)
    #return fact[n] * factinv[r] * factinv[n-r] % p

def cmb_old(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p



N = n

def pow(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
        print(n,x,ans)
    return ans

#pow(2,9)
#exit()

p = 10 ** 9 + 7
#N = 10 ** 6  # N は必要分だけ用意する
"""
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
"""
ans = power_func(2,n,p)-1
#print(ans)
#exit()
#print(cmb(n, a, p) , cmb(n, b, p))
#print(ans,cmb(n, a, p),cmb(n, b, p))
ans -= (cmb(n, a, p) + cmb(n, b, p))

print(ans%p)

Measured memory_bytes: 42808
// Author : Mohamed Sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
const int M = 1e5 + 3 ;
int n , m ;
int x[M] , y[M];
int par[M];
int a[M];
int idx[M];
int getpar(int u )
{
    return ( u != par[u] ? par[u] = getpar(par[u]) : u );
}
void conect (int u , int v )
{
    u = getpar( u );
    v = getpar( v );
    if (u != v )par[u] = v;
}
int main()
{
    scanf ("%d%d" , &n ,&m );
    for (int i =0 ; i < n ;i++)par[i] = i ;
    for (int i =0 ; i< n ;i++)
        scanf ("%d" ,a+ i),idx[ a[i] ] = i ;
    for (int i= 0 ;i < m ; i++)
    {
        scanf ("%d%d" ,x+i , y + i );
        x[i]--;
        y[i]--;
        conect(x[i] , y[i]);
    }
    int ans =0 ;

    for (int i =0 ; i < n ; i++)
    {
       // cout << i <<" " << idx[i+1] <<"\n";
        if (getpar(i) == getpar( idx[i+1] ))
        {
            ans++;
        }
    }
    printf ("%d\n" ,ans );



}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
typedef long long ll;
#define REP(i,n) for(int i = 0;i < (n);i++)
using namespace std;
const int INF = 1e9;

int a,b,tmp;
int main(){
  cin>>a>>b;
  for(int i=1;i<b-a;i++){
    tmp+=i;
  }
  cout<<tmp-a<<endl;
  return 0;
}



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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    vector<int> a(n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    vector<int> v=a;
    sort(v.begin(),v.end(),greater<int>());
    for(int i=0;i<n;i++) printf("%d\n",(a[i]!=v[0]?v[0]:v[1]));
    return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define endl '\n'
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
#define mx 200005
#define inf 2e9
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int main()
{
    int h,w;
    cin>>h>>w;
    int a[h+1][w+1];
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            char c;
            cin>>c;
            if(c == '.')
                a[i][j] = 1;
            else
                a[i][j] = 0;
        }
    }
    int dp[h+1][w+1];
    for(int i=0;i<=h;i++)
    {
        for(int j=0;j<=w;j++)
            dp[i][j] = 0;
    }
    for(int i=1;i<=h;i++)
    {
        if(a[i][1]==1)
            dp[i][1] = 1;
        else
        {
            dp[i][1] = 0;
            break;
        }
    }
    for(int i=1;i<=w;i++)
    {
        if(a[1][i]==1)
            dp[1][i] = 1;
        else
        {
            dp[1][i] = 0;
            break;
        }
    }
    for(int i=2;i<=h;i++)
    {
        for(int j=2;j<=w;j++)
        {
            if(a[i][j] == 1)
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
            else if(a[i][j] == 0)
                dp[i][j] = 0;
        }
    }
    cout<<dp[h][w]%mod<<endl;
}


Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>

using namespace std;

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

int main()
{
    int a, b;
    char buf[32] = "";

    while (cin >> a >> b, b) {
        map<int, int> mp;
        mp[a] = 0;
        int j;
        for (j = 1; ; j++) {
            sprintf(buf, "%0*d", b, a);
            sort(buf, buf+b);
            int c = atoi(buf);
            reverse(buf, buf+b);
            int d = atoi(buf);
            a = d - c;

            if (!mp.insert(pair<int,int>(a, j)).second) {
                break;
            }
        }

        int r = mp[a];
        printf("%d %d %d\n", r, a, j - r);
    }

    return 0;
}

Measured memory_bytes: 3288
#include <stdio.h>
int main()
{
    int n, k, tmp, cnt = 0;
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &tmp);
        if (tmp >= k)
        {
            cnt++;
        }
    }
    printf("%d\n", cnt);
    return 0;
}

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

int main(){
    int n; cin >> n;
    vector<pair<pair<string, int>,int> > shop(n);
    for(int i = 0; i < n; i++){
        string s; int t; cin >> s >> t;
        shop[i]=make_pair(make_pair(s,-t),i);
    }
    sort(shop.begin(), shop.end());
    for(int i = 0; i < n; i++) cout << shop[i].second + 1 << endl;
}


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

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s[0]==s[1]&&s[2]==s[3]&&s[0]!=s[3]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
from collections import deque, defaultdict

N, M = map(int, input().split())
outs = defaultdict(list)

for _ in range(M):
    v1, v2 = map(int, input().split())
    #v1, v2 = v1-1,v2-1
    outs[v1].append(v2)
    outs[v2].append(v1)

# print(outs)
q = deque([1])
depth = defaultdict(int)
depth[1] = 0
visit = [False]*N #配列なので0オリジン
visit[0] = True
# print(visit)
while q:
    v1 = q.popleft()
    # print("a",v1)
    for v2 in outs[v1]: #v1のノードから出ている矢印をみる．
        # print("b",v2)
        if visit[v2-1]==False:
            visit[v2-1] = True
            depth[v2] = v1
            q.append(v2)
            # print(v2,q,depth)

b = sorted(depth.items())
# print(b)
print("Yes")
for i in range(1,N):
    print(b[i][1])

Measured memory_bytes: 54884
l_str = input()
q = int(input())
ord = []
for i in range(q):
    ord = list(input().split())
    if ord[0] == "print":
        a = int(ord[1])
        b = int(ord[2])
        print(l_str[a:b+1])
    if ord[0] == "reverse":
        a = int(ord[1])
        b = int(ord[2])
        c = l_str[a:b+1][::-1]
        l_str = l_str[:a] + c + l_str[b+1:]
    if ord[0] == "replace":
        a = int(ord[1])
        b = int(ord[2])
        p = ord[3]
        l_str = l_str[:a] + p + l_str[b+1:]



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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	ll N, A, B;
	cin >> N >> A >> B;
	ll N2 = N / (A+B);
	ll N3 = N % (A+B);
	if (A != 0)
	{
		if (N3 <= A)
		{
			cout << (N2 * A + N3) << '\n';
		}
		else//N3>A
		{
			cout << (N2 * A + A) << '\n';
		}
	}
	else
	{
		cout << 0 << '\n';
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char ch[51][51];
bool a[51][51];
int h,w;
int main(){
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
		    cin>>ch[i][j];
		    a[i][j]=ch[i][j]=='#'? 1:0;
		}
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(a[i][j])cout<<"#";
			else cout<<a[i-1][j]+a[i+1][j]+a[i][j+1]+a[i][j-1]+a[i-1][j-1]+a[i-1][j+1]+a[i+1][j-1]+a[i+1][j+1];
		}
		cout<<endl;
	}
	return 0;
}

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

int main () {
	char s[101];
	int i;
	scanf ("%[^\n]", s);
	int pnjg = strlen (s);
	for (int i = 0; i < pnjg ; i++) {
		if (s[i] == ',') {
			s[i] = ' ';
		}
	}
	printf ("%s", s);
	
	return 0;
}

Measured memory_bytes: 1664
using System.Linq;
using System.Text;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Reflection.Metadata;

namespace AtCoder
{
    class Program
    {

        const int BiggestMod = 1000000007;


        public static void Main()
        {

            var args = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var h = args[0];
            var w = args[1];
            var k = args[2];
            var ans = 0;

            var board = new bool[h][];
            var boardlow = new int[h];

            for (int i = 0; i < h; i++)
            {
                board[i] = Console.ReadLine().ToArray().Select(x => x == '#').ToArray();
                boardlow[i] = board[i].Count(x => x == true);
            }

            k = boardlow.Sum() - k;

            Solve();

            void Solve()
            {

                for (int i = 0, l = (1 << (h + w)); i < l; i++)
                {

                    var res = 0;
                    var buf = new List<int>();

                    for (int j = 0; j < h; j++)
                        if ((i  & (1 << j)) != 0)
                        {

                            res += boardlow[j];
                            buf.Add(j);

                        }

                    if (res > k) continue;

                    for (int j = 0; j < w; j++)
                        if ((i & (1 << (j + h))) != 0)
                        {

                            for (int ii = 0; ii < h; ii++)
                                if ((!buf.Contains(ii)) && board[ii][j] == true)
                                    res++;

                        }

                    if (res == k)
                        ans++;

                }

                Console.WriteLine(ans);

            }


        }
    }

}

Measured memory_bytes: 28348
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    ll ans = A[0] == 0 ? 0 : LINF;
    rep(i, 1, N) {
        if (A[i] == A[i - 1] + 1) {
            ans++;
        }
        else if (A[i] <= A[i - 1] && A[i] <= i) {
            ans += A[i];
        }
        else ans = LINF;
    }

    write(ans >= LINF ? -1 : ans);
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
	"io"
	"os"
)

func answer(reader io.Reader, writer io.Writer) {
	var a, b int
	_, _ = fmt.Fscan(reader, &a)
	_, _ = fmt.Fscan(reader, &b)
	_, _ = fmt.Fprintf(writer, "%d", a-b+1)
}

func main() {
	answer(os.Stdin, os.Stdout)
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<long long> vll, vLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vint sc(26,-1);
    vint tc(26,-1);
    string s,t;
    cin >> s >> t;
    int l = s.length();
    bool f = true;
    REP(i,l){
        int c = s[i]-'a';
        int d = t[i]-'a';
        if(sc[c]== -1){
            sc[c]=d;
        }else if(sc[c] != d){
            f = false;
            break;
        }
        if(tc[d]==-1){
            tc[d]=c;
        }else if(tc[d]!=c){
            f = false;
            break;
        }
    }
    if(f){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
    return 0;
}

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

using namespace std;

namespace {
    string s;
    void input() {
        cin >> s;
    }

    void solve() {
        int count[3]; memset(count, 0, sizeof(count));
        for (auto c : s) {
            count[c - 'a']++;
        }
        sort(count, count+3);
        cout << (count[2] - count[0] <= 1 ? "YES" : "NO") << endl;
    }
}

int main() {
    input(); solve();
    return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main(){ 
    long long int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k<=a){
        cout<<k<<endl;
    }else if(k<=(a+b)){
        cout<<a<<endl;
    }else{
        cout<<a-(k-a-b)<<endl;
    }
 
    return 0;
}

Measured memory_bytes: 3640
n = int(input())
a = list(map(int, input().split()))
num = [0] * n
cnt = 0

for i in a:
    num[i - 1] += 1

for i in num:
    cnt += i * (i - 1)//2

for i in range(n):
    tmp = num[a[i]-1]
    ans = cnt - ((tmp-(tmp-2)) * (tmp-1) // 2)
    print(ans)


Measured memory_bytes: 25644
#include <iostream>

#define int long long

int rec(int a, int b) {
  if(b == 0)
    return -a;

  return (a/b)*2*b + rec(b, a%b);
}

signed main() {
  int n, x;
  std::cin >> n >> x;

  std::cout << n + rec(std::max(n-x, x), std::min(n-x, x)) << std::endl;
  
  return 0;
}


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

int main()
{
	int n;
	cin>>n;
	double p[n];
	for (int i = 0; i < n; ++i)
	{
		/* code */
		cin>>p[i];
	}
	double dp[n+1][n+1];
	memset(dp,0,sizeof dp);
	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i)
	{
		dp[i][0] = 1;
	}

	for (int i = 1; i <= n; ++i)
	{
		for(int j = 1; j<=i; j++)
		{
			dp[i][j] = dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1-p[i-1]);
		}
	}
	double ans = 0;
	// for (int i = (n+1)/2; i <= n; ++i)
	// {
	// 	ans += dp[n][i];
	// }
	cout<<fixed<<setprecision(10)<<dp[n][(n+1)/2]<<endl;
}

Measured memory_bytes: 70528
#include <stdio.h>
int a,b,c,ans;
int main() {
 scanf("%d %d %d",&a,&b,&c);
 ans=b/a;
 if(ans>c)
  {printf("%d",c);} 
 else
  {printf("%d",ans);}
  
  
  
  
  
  
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int S,h,m,l,H,M,A,B,C,D;
    cin>> S;
    A = S%3600;
    H = S-A;
    h = H/3600;
    B = S-H;
    C = B%60;
    M = B-C;
    m = B/60;
    D = B-M;
    l = D;
    cout<< h <<":"<< m <<":"<< l <<endl;
}



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

int main(){
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int num;
	
	if(k<=a) num=1*k;
	else if(a<k&&k<=a+b) num=1*a;
	else if(a+b<=k&&k<=a+b+c) num=1*a-1*(k-a-b);
	
	cout<<num;
	return 0;
}

Measured memory_bytes: 3636