akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(ll i = 0; i < n; i++)
using namespace std;
typedef long long ll;
 
int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  sort(A.begin(), A.end());
  bool judge = 1;
  rep(i, N-1){
    if(A[i] == A[i+1]){
      judge = 0;
      break;
    }
  }
  if(judge){
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }
  
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007

ll go(ll n, ll x)
{
    ll s = (3 * n * x) % MOD;
    s = (s + (3 * n) % MOD) % MOD;
    s = (s - (2 * x * x) % MOD + MOD) % MOD;
    s = (s + 8) % MOD;
    s = (s * x) % MOD;
    s = (s * 166666668LL) % MOD;
    return s;
}

int main()
{
    ll N, k;
    cin >> N >> k;
    cout << (go(N, N + 1) - go(N, k - 1) + MOD) % MOD << "\n";
    return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
 	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		int ans = B/A;
		if (ans >= C) {
			System.out.println(C);
		} else {
			System.out.println(ans);
		}
 	}
}


Measured memory_bytes: 23380
import numpy as np

N, M, C = list(map(int, input().split()))
B = np.array(list(map(int, input().split())))

count = 0
for _ in range(N):
    A = np.array(list(map(int, input().split())))
    multiply_sum_array = sum(A * B) + C
    if multiply_sum_array > 0:
        count += 1
        
print(count)

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

int N, A, B;
string s;
map<string, int> m;

int main() {
  cin >> N >> A >> B >> s;
  for (int i = 0; i < N; ++i) {
    char p = s[i];
    int ab_sum = m["a"] + m["b"];
    
    if (p == 'c') {
      cout << "No" << endl;
      continue;
    }
    else if (p == 'a') {
      if (ab_sum < A + B) {
        cout << "Yes" << endl;
        m["a"]++;
      }
      else cout << "No" << endl;
    }
    else if (p == 'b') {
      m["b_rank"]++;
      if (ab_sum < A + B && m["b_rank"] <= B) {
        cout << "Yes" << endl;
        m["b"]++;
      }
      else cout << "No" << endl;
    }
  }
  
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  string S;
  cin >> S;
  
  int count = 0;
  
  for(int i = 0; i < S.size()-1; i++){
    if(S.at(i) != S.at(i+1)){
      count++;
    }
  }
  
  count++;
  
  cout << count;
}

Measured memory_bytes: 512
// Why I am so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

int arr[100005];

int n, ans;

void solve() {                   
	scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {
    	scanf("%d", &arr[i]);
    }

    for (int l = 1, r1, r2; l <= n; l = max(r1, r2)) {
		r1 = l + 1, r2 = l + 1;

		while (r1 <= n && arr[r1] >= arr[r1 - 1]) {
			++r1;
		}

		while (r2 <= n && arr[r2] <= arr[r2 - 1]) {
			++r2;
		} 

		++ans;
    }

    printf("%d\n", ans);
}

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b) - 1; (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,ans = 0;
    cin >> n;
    int d[n];
    rep(i, n)cin >> d[i];
    rep(i, n){
        nfor(j, i + 1, n){
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int n; cin >> n;
  vector<int> a(n); rep(i, n) cin >> a[i];
  sort(a.rbegin(), a.rend());
  ll ans = a[0];
  rep(i, n-2) {
    ans += a[i/2+1];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4016
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int ans = A - (B * 2);
        if(ans < 0) ans = 0;
        System.out.println(ans);
    }
}


Measured memory_bytes: 23892
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

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

void Main() {
  int n;
  cin >> n;
  int x = n * 100 / 108;
  while (x * 108 / 100 <= n) {
    if (x * 108 / 100 == n) {
      cout << x << endl;
      return;
    }
    x++;
  }
  cout << ":(" << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N,A,B,C,D = I()
S = s()
if "##" in S[A-1:C] or "##" in S[B-1:D]:
    print("No")
else:
    if C > D and "..." not in S[B-2:D+1]:
        print("No")
    else:
        print("Yes")


Measured memory_bytes: 10372
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	public static void main(String[] args) {
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		
		int v[]=new int[B];
		
		int t=A%B;
		int x=0;
		while(true) {
			x+=t;
			x%=B;
			if(x==C) {
				p("YES");
				break;
			}
			if(v[x]!=0) {
				p("NO");
				break;
			}
			v[x]++;
		}
		
		
	}
	
	
	
	
	/*static boolean v(int i,long sum1,long sum2) {
		if(i==N) {
			long b=Math.abs(sum1-sum2);
			if(b==0) {
				if(sum1<=K) {
					return true;
				}else return false;
			}else if(b%D==0) {
				if(Math.max(sum1, sum2)<=K)return true;
				else return false;
			}
			else return false;
		}
		
		if(v(i+1,sum1,sum2+v[i]%D))return true;
		
		if(v(i+1,sum1+D-v[i]%D,sum2))return true;
		return false;
		
	}*/
	
	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 23124
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
   int A,B,C,K;
   cin >> A >> B >> C >> K;
   int ans = 0;
   if(K<=A){
      ans = K;
   }
   else{
      ans = A;
   }
   K-=A;
   K-=B;
   if(K> 0){
      ans -= K;
   }
   cout << ans  << endl;
   return 0;
}


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

int main() {
  int x;
  cin >> x;
  int c = x / 100, d = x % 100;
  if(d == 0) cout << 1 << endl;
  else if((d - 1) / 5 < c) cout << 1 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include <functional>
using namespace std;
int a[10],i;
int main()
{
    for(i=0;i<10;i++)
    {
        cin>>a[i];
    }
    sort(a,a+10,greater<int>());
    cout<<a[0]<<endl;
    cout<<a[1]<<endl;
    cout<<a[2]<<endl;
    return 0;
}

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

typedef long long int ll;
#define INF 1<<20

struct Node {
	public:
		vector <ll> edge_to; //接続されているノードID
		vector <ll> edge_cost; //エッジのコスト
		bool done;
		ll id, cost;
};

bool operator < (const Node &a, const Node &b){
	return (a.cost < b.cost);
}
bool operator > (const Node &a, const Node &b){
	return (a.cost > b.cost);
}


vector<Node> node;
vector<ll> x_cost;
vector<ll> y_cost;
void dijkstra(ll s) {
	priority_queue<Node, vector<Node>, greater<Node> > pq;
	node[s].cost = 0;
	pq.push(node[s]);
	while(!pq.empty()){
		Node n = pq.top(); pq.pop();
		for (ll i = 0; i < n.edge_to.size(); i++) {
			if (!node[n.edge_to[i]].done) {
				if (node[n.edge_to[i]].cost > n.cost + n.edge_cost[i]) {
					node[n.edge_to[i]].cost = n.cost + n.edge_cost[i];
				}
				pq.push(node[n.edge_to[i]]);
			}
		}
		node[n.id].done = true;
	}
}

int main() {
	ll n;
	scanf("%lld",&n);
	node.resize(n);
	for (ll i = 0; i < n; i++) {
		node[i].id = i;
		node[i].done = false;
		node[i].cost = INF;
	}
	for (ll i = 0; i < n-1; i++) {
		ll a, b;
		scanf("%lld %lld",&a, &b);
		a--; b--;
		node[a].edge_to.push_back(b);
		node[a].edge_cost.push_back(1);
		node[b].edge_to.push_back(a);
		node[b].edge_cost.push_back(1);
	}

	dijkstra(0);
	x_cost.resize(n);
	y_cost.resize(n);
	for (ll i = 0; i < n; i++) {
		x_cost[i] = node[i].cost;
	}
	for (ll i = 0; i < n; i++) {
		node[i].done = false;
		node[i].cost = INF;
	}
	dijkstra(n-1);
	for (ll i = 0; i < n; i++) {
		y_cost[i] = node[i].cost;
	}

	ll x_cnt = 0;
	ll y_cnt = 0;

//
//
//	cout << endl;
//	for (ll i = 0; i < n; i++) {
//		cout << x_cost[i] << " " << y_cost[i] << endl;
//	}
//	cout << endl;
//
//

	for (ll i = 0; i < n; i++) {
		if (x_cost[i] <= y_cost[i]) {
			x_cnt ++;
		} else {
			y_cnt ++;
		}
	}

	if (x_cnt > y_cnt) {
		cout << "Fennec" << endl;
		return 0;
	} else {
		cout << "Snuke" << endl;
		return 0;
	}

}


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

using namespace std;

#define INF 1e9
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

ll R;

void solve(){
    cout << 3*R*R << endl;
}

int main(){
    cin >> R;

    solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long fac[200020], finv[200020], inv[200020];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < 200020; i++) {
		fac[i] = fac[i - 1] * i % 998244353;
		inv[i] = 998244353 - inv[998244353 % i] * (998244353 / i) % 998244353;
		finv[i] = finv[i - 1] * inv[i] % 998244353;
	}
}
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % 998244353) % 998244353;
}
int main(){
	COMinit();
	long long n, m, k;
	cin >> n >> m >> k;
	long long ans1 = 0;
	for (int i = 0; i <= k; i++) {
		long long n1 = n - i - 1;
		long long ans = m, m1 = m - 1;;
		while (n1 > 0) {
			if ((n1 & 1) == 1) {
				ans = ans * m1 % 998244353;
			}
			m1 = m1 * m1 % 998244353;
			n1 >>= 1;
		}
		ans = ans * COM(n - 1, i) % 998244353;
		ans1 = (ans1 + ans) % 998244353;
	}
	cout << ans1 << endl;
	return 0;
}

Measured memory_bytes: 8332
#include <iostream>
#include <string>
using namespace std;
int main(){
    string ans("");
    string str;
    cin>>str;
    for(int i=0;i<str.length();i++){
        if(ans=="" && str[i]=='B');
        else if(str[i]=='B') ans.pop_back();
        else ans+=str[i];
    }
    cout<<ans;
}


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

int main(){
  int n;
  while(cin>>n){
    if(!n)break;
    int a[n],b[n];
    int count = 0;
    for(int i=0;i<n;i++)
      cin>>a[i];
    while(true){
      for(int i=0;i<n;i++){
	int c = 0;
	for(int j=0;j<n;j++)
	  if(a[j] == a[i])
	    c++;
	b[i] = c;
      }
      bool bb = true;
      for(int i=0;i<n;i++){
	if(a[i] != b[i]) bb = false;
	a[i] = b[i];
      }
      if(bb)break;
      count++;
    }
    cout<<count<<endl;
    cout<<a[0];
    for(int i=1;i<n;i++)
      cout<<" "<<a[i];
    cout<<endl;
  }
  return 0;
}

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

int main(){

	int numOfElement;
	int elem[100];

	cin >> numOfElement;

	for(int i = 0; i < numOfElement; i++){
		cin >> elem[i];
	}

	int swapCounter = 0;

	for(int i = 0; i < numOfElement; i++){
		int miniIndex = i;
		for(int j = i; j < numOfElement; j++){
			if(elem[miniIndex] > elem[j]){
				miniIndex = j;
			}
		}
		if(miniIndex != i){
			swapCounter ++;
			int buf = elem[i];
			elem[i] = elem[miniIndex];
			elem[miniIndex] = buf;
		}

	}

	for(int i= 0; i < numOfElement; i ++){
		cout << elem[i];
		if(i + 1 == numOfElement)cout << endl;
		else cout << " ";
	}

	cout << swapCounter << endl;



	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define time cerr << (0.1 * clock()) / CLOCKS_PER_SEC << endl;
#define mod 1000000007
typedef long long ll;
typedef pair<ll, ll> pl;
#define forn(n) for (ll i = 0; i < ll(n); i++)

void convr(vector<string>& v, int res) {
    for (int i = 0; i < v.size(); ++i) {
        if (res & (1 << i)) {
            for (int j = 0; j < v[i].size(); ++j) {
                v[i][j] = '.';
            }
        }
    }
}

void convc(vector<string>& v, int res) {
    for (int i = 0; i < v[0].size(); ++i) {
        if (res & (1 << i)) {
            for (int j = 0; j < v.size(); ++j) {
                v[j][i] = '.';
            }
        }
    }
}

int count(vector<string>& v) {
    int c = 0;
    for (auto i : v) {
        for (auto j : i) {
            if (j == '#') {
                c++;
            }
        }
    }
    return c;
}

void solve() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> v(h);
    forn(h) {
        cin >> v[i];
    }
    int ans = 0;
    for (int i = 0; i < (1 << h); ++i) {
        vector<string> temp(v);
        convr(temp, i);
        for (int j = 0; j < (1 << w); ++j) {
            vector<string> te(temp);
            convc(te, j);
            if (count(te) == k) {
                ans++;
            }
        }
    }
    cout << ans << '\n';
}

int main() {
    quick;
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
}

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

int main(){
	int a, b;
	cin >> a >> b;

	int ans = 0;
	for(int i = 1; i <= 9; i++){
		for(int j = 0; j <= 9; j++){
			for(int k = 0; k <=9; k++){
				int sum = 10001*i+1010*j+100*k;
				if(a <= sum && sum <= b)
					ans++;
			}
		}
	}
	cout << ans << endl;
}

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

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

#define endl '\n'
#define ff first
#define ss second
#define sz(v) (int)v.size()
#define int long long
#define pb push_back
#define f(i,l,r) for(ll i=l;i<=r;i++)
#define rf(i,r,l) for(ll i=r;i>=l;i--)
#define Max 5000001
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define d0(a) cout<<a<<' ';
#define d1(a) cout<<a<<endl;
#define d2(a,b) cout<<a<<' '<<b<<endl;
#define d3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define d4(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
#define d5(a,b,c,d,e) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl;
#define d6(a,b,c,d,e,f) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl;

const ll N=1e5+5,mod=1e9+7,bit=61;



signed main()
{
    fast;

    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        cout<<min(n%k,k-n%k)<<endl;
    }
    return 0;
}


















Measured memory_bytes: 384
import sys
import math

def resolve():
    N = int(input())
    mods = []
    target = N
    if N == 0:
        print("0")
        return
    while True:
        if target == 1:
            mods.append("1")
            break
        v = target // (-2)
        c = target % (-2)
        if c == -1:
            v += 1
            c = 1
        mods.append(str(c))
        target = v
    mods.reverse()
    print("".join(mods))

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 38256
#include <iostream>
#include <cstdlib>
#include <vector>
#define llint long long

using namespace std;

llint h, w, k;
vector<llint> vec[305];
llint ans[305][305];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> h >> w >> k;
	char c;
	for(int y = 1; y <= h; y++){
		for(int x = 1; x <= w; x++){
			cin >> c;
			if(c == '#') vec[y].push_back(x);
		}
	}
	int id = 1;
	for(int y = 1; y <= h; y++){
		if(vec[y].size() == 0) continue;
		int pre = 1;
		for(int i = 0; i < vec[y].size(); i++){
			for(int j = pre; j <= vec[y][i]; j++) ans[j][y] = id;
			pre = vec[y][i] + 1; id++;
		}
		if(pre <= w){
			for(int j = pre; j <= w; j++) ans[j][y] = id-1;
		}
	}
	
	for(int y = 2; y <= h; y++){
		for(int x = 1; x <= w; x++){
			if(ans[x][y] == 0) ans[x][y] = ans[x][y-1];
		}
	}
	for(int y = h-1; y >= 1; y--){
		for(int x = 1; x <= w; x++){
			if(ans[x][y] == 0) ans[x][y] = ans[x][y+1];
		}
	}
	
	for(int y = 1; y <= h; y++){
		for(int x = 1; x <= w; x++){
			cout << ans[x][y] << " ";
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2688
L,M=map(int,input().split())
MAX=0
MIN=L
for i in range(M):
  A,B=map(int,input().split())
  MAX=max(MAX,A)
  MIN=min(MIN,B)
if MIN-MAX+1<=0:
  print(0)
else:
  print(MIN-MAX+1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x;
	cin>>x;
	for(int i=-120;i<120;i++){
		for(int j=-120;j<120;j++){
			if(i*i*i*i*i-j*j*j*j*j==x){
				cout<<i<<" "<<j;
				return 0;
			}
		}
	}
	return 0;
}


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

using ll = long long;

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);
 

void solve() {
    string s;
    cin >> s;
    int n = s.length();
    string ans;
    for(int i = 0; i < n; i += 2){
        ans = ans + s[i];
    }
    cout << ans << endl;
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 640
from collections import deque
N,K = map(int,input().split())
C = deque(map(int,input().split()))
D = C.copy()
#print(C)
ans = 1
for i in range(K):
  C.popleft()
  #ans *= C.popleft()

for i in range(N-K):
  preans = D.popleft()
  ans = C.popleft()
  #preans = ans
  #ans *= C.popleft()
  #ans /= D.popleft()
  if preans < ans:
    print("Yes")
  if preans >= ans:
    print("No")

Measured memory_bytes: 31480
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
const int MAX =1e5+6;
const long long inf=1e18;

int main(){
	 int n , m;
	 cin>>n>>m;
	 pair<int , int>p[n+1];
	 for(int i=0;i<n;i++){
	 	cin>>p[i].first>>p[i].second;
	 }
	 sort(p , p+n);
	 int ans=0;
	 int j=0;
	 priority_queue<int>pq;
	 for(int i=1;i<=m;i++){
	 	while(j<n&&p[j].first<=i){
	 		pq.push(p[j++].second);
	 	}
	 	if(!pq.empty()){
	 		ans=ans+pq.top();
	 		pq.pop();
	 	}
	 }
	 cout<<ans;
	}

Measured memory_bytes: 1660
#include <stdio.h>

int main(void)
{
	int i, j;
	int count = 0;
	char s[5];

	scanf("%s", s);

	for (i = 0; i < 3; i++) {
		for (j = i + 1; j < 4; j++) {
			if (s[i] == s[j]) {
				count++;
			}
		}
	}

	if (count == 2) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <math.h>
using namespace std;

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

    int N;
    cin>>N;

    cout<<N*N*N<<"\n";
    return 0;

}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <complex>

using namespace std;
typedef long long ll;
#define loop(i,a,b) for(ll i=(a); i<ll(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef complex<double> P;

int main(){
    int n;
    while (cin >> n && n){
        vvi g(n, vi(n));
        int x = n / 2, y = n / 2 + 1;
        loop(i, 1, n*n + 1){
            // cout << x << " " << y << endl;
            g[y][x] = i;
            x = (x + 1) % n, y = (y + 1) % n;
            if (g[y][x]) x = (x - 1 + n) % n, y = (y + 1) % n;
        }
        rep(i, n)rep(j, n){
            printf("%4d", g[i][j]);
            if (j + 1 == n) puts("");
        }
    }
}

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

using namespace std;

const long long MOD = 1e9 + 7;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pii> iii;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef priority_queue<pii, vector<pii>, greater<pii>> fila_prioridade;
typedef priority_queue<iii, vector<iii>, greater<iii>> fila_prioridade_grids;

#define nl '\n'
#define INF 1000000000
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define NeedForSpeed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);


int n;
int a[105];

int main() {
        NeedForSpeed
	
	cin >> n;

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

	sort(a, a + n,greater<int>());

	int p1 = 0;
	int p2 = 0;

	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			p1+= a[i];
		} else {
			p2 += a[i];
		}
	}

	cout << abs(p1 - p2) << nl;


        return 0;
}



Measured memory_bytes: 3616
using System;
class Program
{
    public static void Main()
    {
        string s1, s2;
        s1 = Console.ReadLine();
        s2 = Console.ReadLine();
        if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0])
            Console.WriteLine("YES");
        else
            Console.WriteLine("NO");
    }
}

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

int main() {
  string a,b,c;
  cin>>a>>b>>c;
  string rgb=a+b+c;
  int abc=stoi(rgb);
  if(abc % 4==0){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}


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

typedef struct
{
	int c;
	int m[4];
	int s[4];
} TEAM;

int comparison(const void* a, const void* b);

int main(void)
{
	int n;
	TEAM* team;
	
	while (scanf("%d", &n) * n != 0){
		int i;
		
		team = (TEAM*)calloc(n, sizeof(TEAM));
		for (i = 0; i < n; i++){
			int j;
			
			scanf("%d", &team[i].c);
			for (j = 0; j < 4; j++){
				scanf("%d %d", &team[i].m[j], &team[i].s[j]);
			}
		}
		qsort(team, n, sizeof(TEAM), comparison);
		printf("%d\n", team[0].c);
		printf("%d\n", team[1].c);
		printf("%d\n", team[n - 2].c);
		
		free(team);
	}
	
	return 0;
}

int comparison(const void* a, const void* b)
{
	int sum_a, sum_b;
	int i;
	
	sum_a = sum_b = 0;
	for (i = 0; i < 4; i++){
		sum_a += ((TEAM*)a)->m[i] * 60 + ((TEAM*)a)->s[i];
		sum_b += ((TEAM*)b)->m[i] * 60 + ((TEAM*)b)->s[i];
	}
	if (sum_a > sum_b){
		return 1;
	}
	else if (sum_a < sum_b){
		return -1;
	}
	else {
		return 0;
	}
}

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

using namespace std;

#define Rep(i,a,b)  for (int i=(a);i<(b);i++)
#define rep(i,n)    for (int i=0;i<(n);i++)
#define all(x)      (x).begin(), (x).end()

#define ll long long

int main()
{
	int n, m;
	int p[100000], y[100000];
	vector<int> yd[100001];

	cin >> n >> m;

	rep (i, m) {
		cin >> p[i] >> y[i];
		yd[p[i]]. push_back(y[i]);
	}

	rep (i, n)
		sort(all(yd[i+1]));

	rep (i, m) {
		cout << setfill('0') << setw(6) << p[i];
		int index = lower_bound(all(yd[p[i]]), y[i]) - yd[p[i]].begin() + 1;
		cout << setfill('0') << setw(6) << index << endl;
	}
}



Measured memory_bytes: 7808
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
using Graph = vector<vector<int>>;
Graph G;

void dfs(int s, map<pair<int, int>, int> &ma, vector<int> &color,
         set<int> &cnt) {
    int c = 0;
    for (auto ns : G[s]) {
        if (color[ns] != -1)
            continue;
        c++;
        if (color[s] == c)
            c++;
        ma[{min(s, ns), max(s, ns)}] = c;
        color[ns] = c;
        cnt.insert(c);
        dfs(ns, ma, color, cnt);
    }
    return;
}

int main() {
    int N;
    cin >> N;
    G.assign(N, vector<int>());
    vector<vector<int>> nodes(N, vector<int>(2));
    int s;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
        nodes[i][0] = a, nodes[i][1] = b;
    }

    int zisuu = 0;
    rep(i, N) {
        if (G[i].size() > zisuu) {
            zisuu = G[i].size();
            s = i;
        }
    }

    map<pair<int, int>, int> ma;
    vector<int> color(N, -1);
    set<int> cnt;
    color[s] = 0;
    dfs(s, ma, color, cnt);
    cout << cnt.size() << endl;
    rep(i, N - 1) {
        int a = nodes[i][0], b = nodes[i][1];
        cout << ma[{a, b}] << endl;
    }
}

Measured memory_bytes: 20608
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  REP(i,N){
    ll a;
    cin>>a;
    if(i%2==0 && a%2==1) ans++;
  }
  co(ans);
  return 0;
}

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

// グローバル変数としてn, s, ansを定義
int n, s, ans;

void dfs(int i, int sum, int N){  // iは深さ、sumは和、Nは使用した項数
	// 最初はi,sum,Nともに0であることに注意
	
	// 使用した項数がちょうどnかつ、和がsであれば、ans++
	if(N==n && sum==s){
		ans++;
		return;
	}
	// 深さが最後まで到達または、使用した項数がnにもかかわらず和がsでなければ終了
	if(i==10 || N==n){
		return;
	}
	// その数を足す
	dfs(i+1, sum+i, N+1);
	// 足さない
	dfs(i+1, sum, N);
}


int main()
{
	while(cin>>n>>s){
		if(n==0 && s==0){
			break;
		}
		
		// ansを初期化
		ans = 0;
		dfs(0, 0, 0);
		cout<<ans<<endl;
		
	}
	return 0;
}

Measured memory_bytes: 1160
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

alias sread = () => readln.chomp();

void main()
{
    int[] nmm = aryread!int();
    int N = nmm[0];
    int MA = nmm[1];
    int MB = nmm[2];

    int[] A, B, C;

    foreach (_; 0 .. N)
    {
        int[] abc = aryread!int();
        A ~= abc[0];
        B ~= abc[1];
        C ~= abc[2];
    }

    auto dp = new int[][][](N + 1, N * 11 + 1, N * 11 + 1);
    foreach (ref n; dp[0 .. $])
        foreach (ref row; n)
            row[] = int.max;
    dp[0][0][0] = 0;

    foreach (n; 0 .. N)
        foreach (a; 0 .. N * 10 + 1)
            foreach (b; 0 .. N * 10 + 1)
            {
                if (dp[n][a][b] != int.max)
                {
                    dp[n + 1][a + A[n]][b + B[n]] = min(dp[n + 1][a + A[n]][b + B[n]],
                            dp[n][a][b] + C[n]);
                }
                dp[n + 1][a][b] = min(dp[n + 1][a][b], dp[n][a][b]);
            }

    int ma = MA;
    int mb = MB;
    int result = int.max;
    while (ma < N * 10 + 1 && mb < N * 10 + 1)
    {
        if (dp[N][ma][mb] != 0)
        {
            result = result.min(dp[N][ma][mb]);
        }
        ma += MA;
        mb += MB;
    }
    // writeln(dp[N]);
    writeln(result == int.max ? -1 : result);
}


Measured memory_bytes: 40060
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int opt = 0;
        for(int i=0;i<n;i++){
            int num = sc.nextInt();
            boolean check = true;
            for(int j=2;j<=Math.sqrt(num);j++){
                if(num%j==0){
                    check=false;
                    break;
                }
            }
            if(check==true) opt++;
        }
        System.out.println(opt);
    }
}


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

int main () {
  string s;
  cin >> s;
  
  string ans;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'B') {
      if (ans.size() > 0) {
        ans.pop_back();
      }
    }
    else {
      ans.push_back(s[i]);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int H, W, a, b, dp[105][105];
char chars[105][105];
int main()
{
	cin >> H >> W;
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			cin >> chars[i][j];
		}
	}
	if (chars[0][0] == '#')
	{
		dp[0][0] = 1;
	}
	for (int i = 1; i < H; i++)
	{
		if (chars[i][0] == '#')
		{
			if (chars[i - 1][0] == '#')
			{
				dp[i][0] = dp[i - 1][0];
			}
			else
			{
				dp[i][0] = dp[i - 1][0] + 1;
			}
		}
		else
		{
			dp[i][0] = dp[i - 1][0];
		}
	}
	for (int j = 0; j < W; j++)
	{
		int i = 0;
		if (chars[0][j] == '#')
		{
			if (chars[0][j - 1] == '#')
			{
				dp[0][j] = dp[0][j - 1];
			}
			else
			{
				dp[0][j] = dp[0][j - 1] + 1;
			}
		}
		else
		{
			dp[i][j] = dp[0][j - 1];
		}
	}
	for (int i = 1; i < H; i++)
	{
		for (int j = 1; j < W; j++)
		{
			if (chars[i][j] == '#')
			{
				if (chars[i - 1][j] == '#')
				{
					a = dp[i - 1][j];
				}
				else
				{
					a = dp[i - 1][j] + 1;
				}
				if (chars[i][j - 1] == '#')
				{
					b = dp[i][j - 1];
				}
				else
				{
					b = dp[i][j - 1] + 1;
				}
				dp[i][j] = min(a, b);
			}
			else
			{
				dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]);
			}
		}
	}
	cout << dp[H - 1][W - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
 
    ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }

    void solve (){
        int n;
        cin>>n;
        vector<int>a(n);
        for(int i=0;i<n;i++)
            cin>>a[i];
        map<int,int>mp;
        for(int i=0;i<n;i+=2)
            mp[a[i]]++;
        vector<pair<int,int>>even;
        for(auto i : mp){
            even.push_back({i.second,i.first});
        }
        mp.clear();
        for(int i=1;i<n;i+=2)
            mp[a[i]]++;
        vector<pair<int,int>>odd;
        for(auto i : mp){
            odd.push_back({i.second,i.first});
        }
        sort(even.begin(),even.end());
        reverse(even.begin(),even.end());
        sort(odd.begin(),odd.end());
        reverse(odd.begin(),odd.end());
        int mini=1e9;
        if(even[0].second!=odd[0].second)
            mini=min(mini,(n/2 - even[0].first)+(n/2 - odd[0].first));
        else{
            if((int)even.size()>=2)
                mini=min(mini,(n/2 - even[1].first)+(n/2 - odd[0].first));
            if((int)odd.size()>=2)
                mini=min(mini,(n/2 - even[0].first)+(n/2 - odd[1].first));
            mini=min(mini,(n/2 - even[0].first)+(n/2));
            mini=min(mini,(n/2 - odd[0].first)+(n/2));
        }
        cout<<mini;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

Measured memory_bytes: 6916
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

bool comp(const string &a,const string &b){
	int i = 0;
	while(a[i] == b[i]){
		i++;
	}
	if(i == a.length()) return 0;
	return a[i] < b[i];
}
bool isvalidnum(const int money, vector<bool> hatenum){
	int m = money;
	int nownum;
	while(m>0){
		nownum = m%10;
		if (hatenum[nownum]) return false;
		m = (m-nownum)/10;
	}
	return true;
}

int main () {
	int money, n;
	cin >> money >> n;
	vector<bool> hatenum(10,false);
	for (int i = 0; i < n; i++){
		int num;
		cin >> num;
		hatenum[num] = true;
	}
	while(true){
		if (isvalidnum(money, hatenum)) break;
		money ++;
	}
	cout << money;

	return 0;
}

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

int h, w, k;
vector<vector<int>> c;
int del;  //何個黒を赤に変えればいいか

int main(){
    int cnt = 0;
    cin >> h >> w >> k;
    c.resize(h);
    rep(i, h){
        c[i].resize(w);
        rep(j, w){
            char a;
            cin >> a;
            c[i][j] = (a=='#')? 1: 0;
            if(c[i][j]==1)cnt++;
        }
    }
    
    del = cnt - k;
    
    int ans = 0;
    
    rep(i, (1<<h)){
        rep(j, (1<<w)){
            int cnt=0;
            rep(k, h){
                rep(l, w){
                    if(c[k][l]==1 && !((1<<k)&i) && !((1<<l)&j))cnt++;
                }
            }
            if(cnt==k)ans++;
        }
    }
    
    cout << ans << endl; 
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.buffer.readline().rstrip()
def resolve():
    n,k=map(int,input().split())
    H=[int(input()) for _ in range(n)]
    H.sort()
    ans=INF
    for i in range(n-k+1):
        ans=min(ans,H[i+k-1]-H[i])
    print(ans)
resolve()

Measured memory_bytes: 44636
#include <bits/stdc++.h>
#define pb push_back
#define tam 102
#define offset 320000
#define se second
#define fi first
#define pitem item*
#define ptr tre*
#define forr(i,p,n) for(int i=p;i<n;i++)
using namespace std;
typedef long long ll;
const ll MOD=1000000007 ;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
typedef pair<ll,ll> ii;
typedef pair<ll,ii> iii;
typedef pair<double,double> pt;
ll peso[tam],valor[tam],dp[tam][tam][tam*3];
int n,W;
ll f(int pos,int celem,int suma)
{
    if (celem*peso[0]+suma>W)
        return -1e9;
    if (pos==n)
        return 0;
    if (dp[pos][celem][suma]!=-1)
        return dp[pos][celem][suma];
    return dp[pos][celem][suma]=max(f(pos+1,celem,suma),f(pos+1,celem+1,peso[pos]-peso[0]+suma)+valor[pos]);
}
int main()
{
    
    cin>>n>>W;
    forr(i,0,n)
    {
        cin>>peso[i]>>valor[i];
    }
    memset(dp,-1,sizeof dp);
    cout<<f(0,0,0)<<endl;
    
}

Measured memory_bytes: 25088
S = str(input())
T = str(input())
length = len(T)
finish = len(S)-length+1
answer = 0
for i in range(finish):
    wordS = S[i:i+length]
    counter = 0
    for j in range(length):
        if wordS[j] == T[j]:
            counter += 1
    answer = max(answer,counter)
print(length-answer)

Measured memory_bytes: 73276
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
    {
        for (int j = 0; j < n; j++)
        {
            s[i] = s[i] + 1;
            if (s[i] > 'Z')
                s[i] = 'A';
        }
    }
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=100010;
int a[N];
ll s[N],f[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int main() {
    int n,k;
    ll la=0,ans=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++) 
	a[i]=gi(),s[i]=s[i-1]+a[i],f[i]=f[i-1]+max(a[i],0);
    for(int i=n;i>=k;la+=max(0,a[i--]))
	ans=max(ans,max(0LL,s[i]-s[i-k])+la+f[i-k]);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 2176
#pragma region noncode
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#pragma endregion

int main() {
    ll k, a, b;
    cin >> k >> a >> b;
    bool ans = false;
    for(size_t i = a; i <= b; i++) {
        if(i % k == 0)
            ans = true;
    }
    if(ans)
        cout << "OK";
    else
        cout << "NG";
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
int m,li,ri;
int prime[maxn];
int dp[maxn];
void caculatePrime(){
	prime[0] = prime[1] = 1;
	for(int i = 2; i*i <= maxn; i++){
		if(!prime[i]){
			for(int j = i*i; j <= maxn; j += i)
			prime[j] = 1;
		}
	}
}
void caculateNumber(){
	for(int i = 1; i <= maxn; i++){
		dp[i] = (!prime[i] && !prime[(i+1)/2]) ? dp[i-1] + 1 : dp[i-1];
	}
}
int main(){
	cin >> m;
	caculatePrime();
	caculateNumber();
	while(m--){
		cin >> li >> ri;
		cout << dp[ri] - dp[li-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <cmath>
#include <unordered_map>

#define likely(x)   __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)

using LL = int;
inline LL R(){
    char c='!';LL x=0,z=1;
    for( ; c>'9'||c<'0';c=getchar()) if(c=='-')z=-1;
    for(;c>='0'&&c<='9';c=getchar()) x=x*10+c-'0';
    return x*z;
}

size_t A[200000];
int main(void) {
  int n;

  std::cin >> n; /* 1 to 3*10^5 */

  //int* A = new int[n];
  for (size_t i = 0; i < n; i++) {
    A[i] = R();
    //std::cin >> A[i];
  }

  size_t count = 0;

  size_t lsum = 0;
  size_t rsum = 0;
  size_t l, r;
  size_t offset = 0;
  size_t i = 0;
  while(i < n) {
    size_t lcount = 0;
    for (size_t j = i + offset; j < n; ++j) {
      l = lsum ^ A[j];
      r = rsum + A[j];
      if (likely(l != r)) {
        break;
      }
      lcount++;
      lsum = l;
      rsum = r;
    }

    count += lcount + offset;

#if 0
    if (lcount + offset > 1) {
      offset = lcount + offset - 1;
    } else {
      offset = 0;
    }
#else
    offset += lcount;
    if (unlikely(offset)) {
      --offset;
    }
#endif
    lsum ^= A[i];
    rsum -= A[i];
    ++i;
  }

  std::cout << count << std::endl;;

  return 0;
}

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

namespace ABC115
{
	class Program
	{
		static void Main(string[] args)
		{

			int d;
			string s = "Christmas ";

			d = int.Parse(Console.ReadLine());


			if (d == 25)
				Console.WriteLine(s);
			if (d == 24)
				Console.WriteLine(s + ("Eve"));
			if (d == 23) 
			Console.WriteLine(s + ("Eve Eve"));
			if (d ==22)
				Console.WriteLine(s + ("Eve Eve Eve"));


		
			Console.ReadKey();



		}
	}
}


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

class AtCoder
{    
    static void Main(string[] args)
     {
        var input = Console.ReadLine().ToUpper();

        var acgt = new Dictionary<string, string>()
        {
            { "A", "T" },
            { "T", "A" },
            { "C", "G" },
            { "G", "C" },
        };

        Console.WriteLine(acgt[input]);
     }
 }

Measured memory_bytes: 11104
import sys

N, M = map(int, sys.stdin.readline().split(" "))

k = []
for i in range(M):
    tmp = list(map(int, sys.stdin.readline().split(" ")))
    k.append(tmp[1:])

p = list(map(int, sys.stdin.readline().split(" ")))

ans = 0
for i in range(2**N):
    switches = []
    for j in range(N):
        switches.append(i >> j & 1)
    # print(switches)
    for i, k_i in enumerate(k):
        on = 0
        for switch_i in k_i:
            # print(switch_i - 1)
            on += switches[switch_i - 1]
        if p[i] != on % 2:
            break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 40688
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n,m;
    cin >> n >> m;
  
  	int ans=0;
  	for(int i=0;i<n;i++) ans += i;
  	for(int i=0;i<m;i++) ans += i;
  
    cout << ans;
}

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

#include <atcoder/fenwicktree>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace atcoder;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t n, q;
    cin >> n >> q;

    fenwick_tree<int64_t> ft(n);

    for (auto i : irange(0L, n)) {
        int64_t a;
        cin >> a;
        ft.add(i, a);
    }

    for (auto _ : irange(0L, q)) {
        int64_t t, a, b;
        cin >> t >> a >> b;

        if (t == 0) {
            ft.add(a, b);
        } else {
            cout << ft.sum(a, b) << endl;
        }
    }
}

Measured memory_bytes: 8220
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            string s = ReadLine();
            List<string> ls = new List<string>();
            string ans = "yes";
            for (int i = 0; i < s.Length; i++)
            {
                if (ls.Contains(s[i].ToString()) == false)
                {
                    ls.Add(s[i].ToString());
                }
                else
                {
                    ans = "no";
                }
            }
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using ull = unsigned long long;
using ll = long long;
using namespace std;

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

    int price = 700;
    for (char t : s) {
        if (t == 'o') {
            price += 100;
        }
    }
    
    cout << price << endl;

    return 0;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#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 FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int num = 1;
    num <<= n;
    vint p(num);
    REP(i,num) cin>> p[i];
    sort(rALL(p));
    //int node = num*2-1;
    vector<int> v;
    v.pb(p[0]);
    p[0]=-1;
    REP(i,n){
        sort(rALL(v));
        vector<int> v2 = v;
        int nowid = 0;
        int parid = 0;
        int ex = (int)v2.size();
        while(nowid<num&&parid<ex){
            int par = v[parid];
            if(p[nowid]==-1){
                nowid++;
                continue;
            }
            if(p[nowid]<par){
                v.pb(p[nowid]);
                p[nowid]=-1;
                parid++;
            }
            nowid++;
        }
        if(parid<ex){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 2932