akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
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 D=365;
vector<int> c(26);
vector<vector<int>> s(365, vector<int>(26));

ll calc(const vector<int>& t, int d, int q){
  ll res = 0;
  vector<int> lst(26,-1);
  rep(i,D){
    if(i!=d){
      if(t[i]!=-1){
        res += s[i][t[i]];
        lst[t[i]] = i;
      }
    }
    else{
      res += s[i][q];
      lst[q]=i;
    }
    rep(j,26){
      res -= c[j]*(i-lst[j]);
    }
  }
  //cerr << res << '\n';
  return res;
}



int main(){

  /*
  ifstream in("input.in");
  cin.rdbuf(in.rdbuf());
  ofstream ofs("output.txt");
  cout.rdbuf(ofs.rdbuf());
  //*/
  chrono::system_clock::time_point start, end;
  start = chrono::system_clock::now();
  mt19937 mt(14);
  cin >> D;
  rep(i,26) cin >> c[i];
  rep(y,D) rep(x,26) cin >> s[y][x];
  vector<int> t(D,-1);
  ll now = calc(t, -1, -1);
  //cerr << now << '\n';
  rep(d,D){
    rep(q,26){
      if(chmax(now,calc(t,d,q))){
        //cerr << "!";
        t[d]=q;
      }
      end = chrono::system_clock::now();
      double ela = chrono::duration_cast<chrono::milliseconds> (end-start).count();
      if(ela>1900) break;
    }
    // timer
    end = chrono::system_clock::now();
    double ela = chrono::duration_cast<chrono::milliseconds> (end-start).count();
    if(ela>1900) break;
  }
  while(1){
    int d=mt()%365, q=mt()%26;
    if(chmax(now,calc(t,d,q))){
      t[d]=q;
    }
    end = chrono::system_clock::now();
    double ela = chrono::duration_cast<chrono::milliseconds> (end-start).count();
    if(ela>1970) break;
  }
  rep(i,D) cout << t[i]+1 << '\n';
  return 0;
}


Measured memory_bytes: 3672
import java.util.*;

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

      int n = Integer.parseInt(sc.next());
      int k = Integer.parseInt(sc.next());

      String s = sc.next();
      int lng = s.length();
      char[] c = new char[lng];
      for(int i=0;i<lng;i++){
        c[i] = s.charAt(i);
      }

      int[] kore = new int[n];
      int[] or01 = new int[n];
      int cnt = 0;
      for(int i=0;i<n-1;i++){
        if(c[i]==c[i+1]){
          kore[cnt]++;
        }
        else{
          if(c[i]=='0'){
            or01[cnt] = 0;
          }
          else{
            or01[cnt] = 1;
          }
          cnt++;
        }
      }
      for(int i=0;i<=cnt;i++){
        kore[i]++;
      }

//////main////////////////////////////////////
int range = 2*k+1;
int ans = 0;
int max = 0;
for(int i=-k;i<=lng-range;i++){

if(i<0){
//////////////////////////////////
for(int j=0;j<range+i;j++){
  max += kore[j];
}
//////////////////////////////////
}
else if(0<=i && i<=lng-range){
//////////////////////////////////
  if(or01[i]==1){
    for(int j=i;j<i+range;j++){
      max += kore[j];
    }
  }
//////////////////////////////////
}
else if(lng-range<i){
//////////////////////////////////
for(int j=i;j<lng;j++){
  max += kore[j];
}
//////////////////////////////////
}
  ans = Math.max(ans,max);
  max = 0;
}
if(cnt==0){
  ans=n;
}
System.out.println(ans);
//////////////////////////////////////////////

      /*for(int kores : kore){
        System.out.println(kores);
      }*/

    }
}


Measured memory_bytes: 25916
import sys
f=lambda:map(int,sys.stdin.readline().split())
n,m=f()
lt=[]
for i in range(m):
  p,y=f()
  lt+=[(p,y,i)]
lt.sort()
d={}
t=c=0
for p,y,i in lt:
  if p>t: t,c=p,1
  else: c+=1
  d[i]=str(p).zfill(6)+str(c).zfill(6)
for _,v in sorted(d.items()): print(v)

Measured memory_bytes: 86108
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;


int main()
{
int a[4];
int b[4];
int count[5];
  for(int k=1;k<=4;k++)count[k]=0;
int out=0;
for(int i=1;i<=3;i++){
  cin>>a[i];
  cin>>b[i];
}
for(int i=1;i<=3;i++){
  for(int k=1;k<=4;k++){
    if(a[i]==k)count[k]++;
    if(b[i]==k)count[k]++;
  }
}
  //for(int k=1;k<=4;k++)cout<<count[k]<<endl;
int sum=0;
for(int k=1;k<=4;k++)if(count[k]%2==1)sum++;

if(sum==0){cout<<"YES"<<endl;}else if(sum==2){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;};
return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut buf = String::new();
    let _ = std::io::stdin().read_line(&mut buf).ok();
    let n:usize = buf.trim().parse().unwrap();
    let mut parent  = vec![-1; n];
    let mut sibling = vec![-1; n];
    let mut degree = vec![0; n];
    let mut children = vec![(-1, -1); n];
    for _ in 0..n {
        let mut buf = String::new();
        let _ = std::io::stdin().read_line(&mut buf).ok();
        let mut buf = buf.split_whitespace();
        let id: usize = buf.next().unwrap().parse().unwrap();
        let c0: i64 = buf.next().unwrap().parse().unwrap();
        let c1: i64 = buf.next().unwrap().parse().unwrap();
        if c0 != -1 {
            parent[c0 as usize] = id as i64;
            sibling[c0 as usize] = c1;
            degree[id] += 1;
            children[id].0 = c0;
            children[id].1 = c1;
        }
        if c1 != -1 {
            parent[c1 as usize] = id as i64;
            sibling[c1 as usize] = c0;
            degree[id] += 1;
            children[id].1 = c1;
        }
        //println!("{}", i);
        //println!("{:?}", parent);
        //println!("{:?}", children);
    }
    let mut depths = vec![-1; n];
    let mut heights = vec![-1; n];
    for i in 0..n {
        if parent[i] == -1 {
            set_depth(0, &children, &mut depths, i);
            set_height(&children, &mut heights, i);
            break;
        }
    }
    for i in 0..n {
        print!("node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, ",
               i, parent[i], sibling[i], degree[i], depths[i], heights[i]);
        if depths[i] == 0 {
            println!("root");
        } else if children[i].0 == -1 && children[i].1 == -1 {
            println!("leaf");
        } else {
            println!("internal node");
        }
    }
}

fn set_depth(depth: usize, children: &Vec<(i64, i64)>, depths: &mut Vec<i64>, id: usize) {
    depths[id] = depth as i64;
    if children[id].0 != -1 {
        set_depth(depth+1, children, depths, children[id].0 as usize);
    }
    if children[id].1 != -1 {
        set_depth(depth+1, children, depths, children[id].1 as usize);
    }
}

fn set_height(children: &Vec<(i64, i64)>, heights: &mut Vec<i64>, id: usize) {
    if children[id].0 == -1 && children[id].1 == -1{
        heights[id] = 0;
    } else {
        let c0_id = children[id].0;
        let c1_id = children[id].1;
        let mut c0_h = 0;
        let mut c1_h = 0;
        if c0_id != -1 {
            if heights[c0_id as usize] == -1 {
                set_height(children, heights, c0_id as usize);
                c0_h = heights[c0_id as usize];
            }
        }
        if c1_id != -1 {
            if heights[c1_id as usize] == -1 {
                set_height(children, heights, c1_id as usize);
                c1_h = heights[c1_id as usize];
            }
        }
        if c0_h > c1_h {
            heights[id] = c0_h + 1;
        } else {
            heights[id] = c1_h + 1;
        }
    }
}



Measured memory_bytes: 5032
#include<cstdio>
#include<iostream>
#include<cstring>
#define RG register
#define ll long long
using namespace std;
const int N=5e3+10;
const ll mod=1e9+7;
int n,len;
ll dp[N][N];
char ss[N];
inline int mx(int a,int b){return a>b ? a : b;}
inline ll powe(ll aa,ll tt){
	ll ans=1;
	for(ll i=tt;i;i>>=1, aa=aa*aa%mod) if(i&1) (ans*=aa)%=mod;
	return ans;
}
int main()
{
//	freopen("Unhappy Hacking.in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%s",&n,ss);
	len=strlen(ss);
	dp[0][0]=1;
	for(RG int i=0;i<=n;i++)
	 for(RG int j=0;j<=i;j++)
	 {
		(dp[i+1][j+1]+=2*dp[i][j])%=mod;
		(dp[i+1][mx(0,j-1)]+=dp[i][j])%=mod;
	 }
	printf("%lld",dp[n][len]*powe(powe(2,len),mod-2)%mod);
	//fclose(stdin); fclose(stdout);
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n,a,b,d,w;
    while(cin >> n >> a >> b)
    {
        d = abs(a - b) - 1;
        if(d % 2 == 0)
            cout << "Borys" << '\n';
        else
            cout << "Alice" << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace AtCoder.ABC068
{
    class Program
    {
        static void Main()
        {
            string[] inputs = Console.ReadLine().Split(' ');
            int n = int.Parse(inputs[0]);
            int m = int.Parse(inputs[1]);
            var connectList = Enumerable.Range(0, n + 1).Select(i => new List<int>()).ToArray();
            for (int i = 0; i < m; i++)
            {
                inputs = Console.ReadLine().Split(' ');
                int a = int.Parse(inputs[0]);
                int b = int.Parse(inputs[1]);
                connectList[a].Add(b);
                connectList[b].Add(a);
            }
            var result = "IMPOSSIBLE";
            var common = connectList[1].Intersect(connectList[n]).ToArray();
            if (common.Length > 0) result = "POSSIBLE";
            Console.WriteLine(result);
        }
    }
}

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


int main() {
    //input
    int n;
    std::cin >> n;

    long long ans = 0;
    string str;
    map<string,int> dic;
    for (int i = 0; i < n; i++) {
        cin >> str;
        sort(begin(str),end(str));
        dic[str]++;
        if(dic[str] > 1){
            ans += dic[str] -1;
        }
    }


    std::cout << ans << std::endl;
    //for (int i=0;i<n;i++){
    //    std::cout << vec.at(i) << std::endl;
    //}


    return 0;
}

Measured memory_bytes: 11136
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,m[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u){
  int v;
  color[u]=GRAY;
  d[u]=++tt;
  for(v=0;v<n;v++){
    if(m[u][v]==0) continue;
    if(color[v]==WHITE){
      dfs_visit(v);
    }
  }
  color[u]=BLACK;
  f[u]=++tt;
}

void dfs(){
  int u;
  for(u=0;u<n;u++) color[u]=WHITE;
  tt=0;

  for(u=0;u<n;u++){
    if(color[u]==WHITE) dfs_visit(u);
  }
  
  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
  }
}

int main(){
  int u,v,k,i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) m[i][j]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      m[u][v]=1;
    }
  }

  dfs();

  return 0;
}



Measured memory_bytes: 2112
// 2015/05/26 Tazoe
 
#include <iostream>
using namespace std;
 
// Nodeクラス
class Node{
public:
    Node* prev; // 前のノードへのポインタ
    Node* next; // 次のノードへのポインタ
    int data;   // データ
    Node(){prev = 0; next = 0; data = 0;}       // デフォルトコンストラクタ
};
 
// Listクラス
class List{
private:
    Node head;  // ヘッドノード（ダミー）
public:
    List(){head.prev = &head; head.next = &head;}   // デフォルトコンストラクタ
    Node* search(int d);        // 探索
    int insert(int x);      // 挿入
    int del(int x);         // 削除
    int deleteFirst();      // 先頭の削除
    int deleteLast();       // 末尾の削除
    void print();           // 表示
};
 
// searchメソッド（探索）
Node* List::search(int d)
{
    for(Node* p=head.next; p!=&head; p=p->next){
        if(p->data==d)
            return p;   // 見つかった
    }
 
    return 0;           // 見つからなかった
}
 
// insertメソッド（挿入）
int List::insert(int x)
{
    Node* p = new Node();
 
    if(p==0)
        return -1;      // メモリ確保エラー
 
    Node* q = &head;
    Node* r = head.next;
 
    p->prev = q;
    p->next = r;
    p->data = x;
 
    q->next = p;
    r->prev = p;
 
    return 0;           // 正常終了
}
 
// delメソッド（削除）
int List::del(int x)
{
    Node* p = search(x);
 
    if(p==0)
        return -2;      // 探索エラー
 
    Node* q = p->prev;
    Node* r = p->next;
 
    q->next = r;
    r->prev = q;
 
    delete p;
 
    return 0;           // 正常終了
}
 
// deleteFirstメソッド（先頭の削除）
int List::deleteFirst()
{
    Node* p = head.next;
 
    if(p==&head)
        return -2;      // 探索エラー
 
    Node* q = p->prev;
    Node* r = p->next;
 
    q->next = r;
    r->prev = q;
 
    delete p;
 
    return 0;           // 正常終了
}
 
// deleteLastメソッド（末尾の削除）
int List::deleteLast()
{
    Node* p = head.prev;
 
    if(p==&head)
        return -2;      // 探索エラー
 
    Node* q = p->prev;
    Node* r = p->next;
 
    q->next = r;
    r->prev = q;
 
    delete p;
 
    return 0;           // 正常終了
}
 
// printメソッド（表示）
void List::print()
{
    for(Node* p=head.next; p!=&head; p=p->next){
        cout << p->data;
        if(p->next==&head){
            cout << endl;
        }
        else{
            cout << ' ';
        }
    }
}
 
 
// main関数
int main()
{
    List L;
 
    int n;
    cin >> n;
 
    for(int i=0; i<n; i++){
        char com[20];
        cin >> com;
 
        if(com[0]=='i'){
            int x;
            cin >> x;
 
            L.insert(x);
        }
        else if(com[6]=='F'){
            L.deleteFirst();
        }
        else if(com[6]=='L'){
            L.deleteLast();
        }
        else{
            int x;
            cin >> x;
 
            L.del(x);
        }
    }
 
    L.print();
 
    return 0;
}

Measured memory_bytes: 32444
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>

const int N = 2e3 + 32, M = 5e6 + 65, P = 1e9 + 7;

int pw(int x, int y) {
	int r = 1;
	for (; y; y >>= 1, x = 1ll * x * x % P)
		if (y & 1) r = 1ll * r * x % P;
	return r;
}

int fac[M], ifac[M];
int c(int n, int m) { return 1ll * n[fac] * m[ifac] % P * (n - m)[ifac] % P; }

int n, k, dp[N][N];
int main() {
	scanf("%d%d", &n, &k);
	if (k == 1) return puts("1"), 0;
	0 [fac] = 0 [ifac] = 1;
	for (int i = 1; i <= n * k; i++) i[fac] = 1ll * (i - 1)[fac] * i % P;
	(n * k)[ifac] = pw((n * k)[fac], P - 2);
	for (int i = n * k - 1; i >= 1; i--) i[ifac] = 1ll * (i + 1)[ifac] * (i + 1) % P;
	for (int i = 0; i <= n; i++)
		for (int j = 0; j <= i; j++)
			if (i || j)
				dp[i][j] = (dp[i - 1][j] +
							(n - j + 1ll) * c(n * k - i - (j - 1) * (k - 1) - 1, k - 2) %
								P * dp[i][j - 1]) %
						   P;
			else
				dp[0][0] = 1;
	printf("%d", dp[n][n]);
}

Measured memory_bytes: 50432
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int N,K,A[200000]={},temp,cou=0,ans=0,i;

int main(){
    cin>>N>>K;
    rep(i,N){
        cin>>temp;
        A[temp-1]++;
    }
    rep(i,N){
        if(A[i])cou++;
    }
    sort(A,A+N);
    while(K<cou){
        if(A[i]==0){
            i++;
            continue;
        }
        ans+=A[i];
        i++;
        cou--;
    }
    out(ans);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

int main() {
	int n; scanf("%d", &n); std::vector<i64> a(3 * n);
	for(int i = 0; i < 3 * n; i++) scanf("%lld", &a[i]);

	std::vector<i64> A = [a, n] {
		std::vector<i64> A(3 * n, 1LL << 60);

		i64 tmp = 0;
		std::priority_queue<i64> qu;
		for(int i = 3 * n - 1; i >= n; i--) {
			tmp += a[i];
			qu.push(a[i]);			
			
			while(!qu.empty() and qu.size() > n) {
				tmp -= qu.top();
				qu.pop();
			}

			if(qu.size() == n) A[i] = tmp;
		}
		return A;
	}();

	i64 ans = -(1LL << 60), tmp = 0;
	std::priority_queue<i64, std::vector<i64>, std::greater<i64>> qu;
	for(int i = 0; i < 2 * n; i++) {
		tmp += a[i];
		qu.push(a[i]);		
		
		while(!qu.empty() and qu.size() > n) {
			tmp -= qu.top();
			qu.pop();
		}

		if(qu.size() == n) ans = std::max(ans, tmp - A[i + 1]);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 8440
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int k, s, counter = 0;
	cin >> k >> s;
	for(int i = 0; i <= s; i++){
		for(int j = i; j <= s; j++){
			if(i <= k && j - i <= k && s - j <= k){
				counter++;
			}
		}
	}
	cout << counter << endl;
	return 0;
}

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

using namespace std;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0); cerr.tie(0);
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = k - 1; i < n - 1; i++) {
		if (a[i + 1] > a[i + 1 - k]) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	}
  return 0;
}


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

int main(){
  int a,b,c;cin>>a>>b>>c;
  bool f=1;
  if(a!=b && a==c) f=0;
  if(b!=c && b==a) f=0;
  if(c!=a && c==b) f=0;
  
  cout<<(f?"No":"Yes");
}


Measured memory_bytes: 256
#include "iostream"
using namespace std;

int num[3][3];
int box[3][3];
int sum;

int main() {
	cin >> num[0][0] >> num[0][1] >> num[1][1];
	box[0][2] = 0;
	box[2][1] = num[0][0] - num[1][1];
	box[2][2] = num[0][1] - num[1][1];
	num[0][2] = num[1][1] - box[2][1] - box[2][2];
	sum = num[0][0] + num[0][1] + num[0][2];
	num[2][0] = sum - num[0][2] - num[1][1];
	num[2][1] = num[0][2] + box[2][1];
	num[2][2] = num[0][2] + box[2][2];
	num[1][0] = sum - num[0][0] - num[2][0];
	num[1][2] = sum - num[0][2] - num[2][2];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cout << num[i][j] << " ";
		}
		cout << "\n";
	}
	return 0;
}

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

void Cont(){
    int N;
    cin >> N;
    vector<int> vec(N);
    int p_differ = 0;
    for(auto& v : vec)
        cin >> v;
    sort(vec.begin(),vec.end());//1 3 5..
    for(int i=N-1;i>=1;i-=2)
        p_differ += vec.at(i) - vec.at(i-1);
    if(N%2)
        p_differ += vec.at(0);
    cout << p_differ << "\n";
}


int main()
{
	std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Cont();
}

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

int main() {
  int N, T; cin >> N >> T;
  pair<int, int> AB[N];
  for (int i = 0; i < N; i++) {
    int a, b; cin >> a >> b;
    AB[i] = make_pair(a, b);
  }
  sort(AB, AB+N, [](pair<int, int> &a, pair<int, int> &b) {
    return a.first < b.first;
  });
  int sat[T+1]; for (int t = 0; t <= T; t++) sat[t] = 0;
  for (int i = 0; i < N; i++)
    for (int t = T-1; t >= 0; t--) {
      int t1 = min(t + AB[i].first, T);
      sat[t1] = max(sat[t1], sat[t]+AB[i].second);
    }
  int maxsat = 0;
  for (int t = 0; t <= T; t++) maxsat = max(maxsat, sat[t]);
  cout << maxsat << endl;
}

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

using namespace std;


void solve() {
    vector<int> A(5);
    for (int i = 0; i < 5; i++) cin >> A[i];
    for (int i = 0; i < 5; i++) {
        if (A[i] == 0) {
            cout << i + 1 << endl;
            return;
        }
    }
}


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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.14159265358979323846264
int main()
{
	int n;
	cin>>n;
	string s[n];
	map<string,int> m;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
		m[s[i]]++;
	}
	map<string,int> ::iterator it;
		//if(m["AC"]>0)
		cout<<"AC"<<" x "<<m["AC"]<<"\n";
			//if(m["WA"]>0)
		cout<<"WA"<<" x "<<m["WA"]<<"\n";
			//if(m["TLE"]>0)
		cout<<"TLE"<<" x "<<m["TLE"]<<"\n";
		
		cout<<"RE"<<" x "<<m["RE"]<<"\n";
	
	return 0;
}

Measured memory_bytes: 6756
#include <iostream>

using namespace std;

int main() {
  string A;
  cin >> A;
  if (A == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (A == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }

  return 0;
}


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

int main(){
  int D, T, S;
  cin >>D >>T >>S;
  
  double time = (double)D / S;
  
  if (time <= T) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 3616
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
ans = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            ans += gcd(i,j,k)
print(ans)

Measured memory_bytes: 69788
import math

class abc_168:
    
    def __init__(self):
        pass
    
    def A(self):
       N=int(input())
       hon=[2,4,5,7,9]
       pon=[0,1,6,8]
       bon=[3]
       
       ans=N%100
       ans=ans%10
       
       if ans in hon:print("hon")
       elif ans in pon:print("pon")
       else :print("bon")
    
    def B(self):
        K=int(input())
        S=input()
        
        if len(S)<=K:print(S)
        else:
            ans=S[0:K]+"..."
            print(ans)
        
    def C(self):
        ABHM=list(map(int,input().split()))
        
        radi=abs((ABHM[2]*5)+((ABHM[3]*5)/60)-ABHM[3])*6
        #print(radi)
        ans=(ABHM[0]**2)+(ABHM[1]**2)-(2*ABHM[0]*ABHM[1]*math.cos(math.radians(radi)))
        print(math.sqrt(ans))
            
    def D(self):
        pass
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_168()
    obj.C()

Measured memory_bytes: 62728
import java.util.*;
import java.util.Collections;

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

        for (int i = A; i <= B; i++) {
            if (i % K == 0) {
                System.out.println("OK");
                return;
            }
        }

        System.out.println("NG");
        return;
    }
}

Measured memory_bytes: 35764
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#define MOD 1000000007LL
using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	if(s[0] == t[2] && s[1] == t[1] && s[2] == t[0]) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp=[[0 for i in range(n)] for j in range(2)]
dp[0][0]=a[0]
for i in range(1,n):
    dp[0][i]=a[i]+dp[0][i-1]
dp[1][0]=dp[0][0]+b[0]
for i in range(1,n):
    dp[1][i]=max(dp[0][i],dp[1][i-1])+b[i]
print(dp[1][n-1])



Measured memory_bytes: 9164
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
struct node
{
	double x,y;
}a[55];
int n,i,j,k,x;
double ans=1e50,w,A1,B1,C1,A2,B2,C2;
node operator -(node a,node b)
{
	return (node){a.x-b.x,a.y-b.y};
}
double dis(node a,node b)
{
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double mult(node a,node b)
{
	return a.x*b.y-a.y*b.x;
}
int main()
{
	scanf("%d",&n);
	for(i=1;i<=n;++i)
		scanf("%lf%lf",&a[i].x,&a[i].y);
	for(i=1;i<=n;++i)
		for(j=i+1;j<=n;++j)
			for(k=j+1;k<=n;++k)
			{
				if(mult(a[j]-a[i],a[k]-a[i])==0.0)
					continue;
				A1=2*(a[j].x-a[i].x),B1=2*(a[j].y-a[i].y),C1=a[i].x*a[i].x+a[i].y*a[i].y-a[j].x*a[j].x-a[j].y*a[j].y;
				A2=2*(a[k].x-a[i].x),B2=2*(a[k].y-a[i].y),C2=a[i].x*a[i].x+a[i].y*a[i].y-a[k].x*a[k].x-a[k].y*a[k].y;
				a[0]=(node){(C2*B1-C1*B2)/(A1*B2-A2*B1),(C2*A1-C1*A2)/(B1*A2-B2*A1)};
				w=0;
				for(x=1;x<=n;++x)
					w=max(w,dis(a[0],a[x]));
				ans=min(ans,w);
			}
	for(i=1;i<=n;++i)
		for(j=i+1;j<=n;++j)
		{
			a[0]=(node){(a[i].x+a[j].x)/2,(a[i].y+a[j].y)/2};
			w=0;
			for(k=1;k<=n;++k)
				w=max(w,dis(a[0],a[k]));
			ans=min(ans,w);
		}
	printf("%.12lf",ans);
	return 0;
}


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

ll x, y, t;

int main() {
  cin >> x >> y;
  rep (i, 70) {
    x *= 2;
    if (y < x) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3524
#include <iostream>
#include <vector>
#include <queue>
#include <fstream>
#include <climits>
#define INF INT_MAX
using namespace std;

class vertex{
public:
  class edge{
  public:
    int to;
    int weight;
    edge(int to, int weight){
      this->to = to;
      this->weight = weight;
    }
  };

  vector<edge> edges;
  int num;
  int dis;

  vertex(){
    num=n;
    n++;
    vertexes.push_back(this);
  }

  bool operator< (const vertex& v) const{
    return dis < v.dis;
  }

  bool operator> (const vertex& v) const{
    return dis > v.dis;
  }

  static void dijkstra(int start){
    //距離の初期化
    for(int i=0; i<n; i++) vertexes[i]->dis=INF;
    vertexes[start]->dis=0;

    //プライオリティキューを初期化、始点を格納
    priority_queue<vertex, vector<vertex>, greater<vertex> > pq; pq.push(*vertexes[start]);

    //キューから最短距離を取り出していく
    while(!pq.empty()){
      vertex now = pq.top(); pq.pop(); //キューの先頭をポップ
      if(now.dis>vertexes[now.num]->dis) continue;

      //ポップしたキューの頂点集合について最短距離更新
      for(int i=0; i<now.edges.size(); i++){
        int newDis = now.dis+now.edges[i].weight;
        vertex* next = vertexes[now.edges[i].to];

        //もし最短距離が更新されたら、キューに入れなおす
        if(newDis < next->dis){
          next->dis = newDis;
          pq.push(*next);
        }
      }

    }


  }

  //各頂点番号と最短距離を出力するための関数
  static void print(){
    for(int i=0; i<n; i++){
      if(vertexes[i]->dis==INF){
        cout << "INF" << endl;
      }else{
        cout << vertexes[i]->dis << endl;
      }
    }
  }
private:
  static int n;
  static vector<vertex*> vertexes;
};

//staticメンバ変数の初期化
int vertex::n=0;
vector<vertex*> vertex::vertexes;

int main(){
  int n, e, r; cin >> n >> e >> r;

  vertex graph[n];

  //入力を隣接リストのようなものに格納
  int v, to, weight;
  for(int i=0; i<e; i++){
    cin >> v >> to >> weight;

    vertex::edge e(to, weight);
    graph[v].edges.push_back(e);
  }

  vertex::dijkstra(r); //0始点のダイクストラ法

  vertex::print();

  return 0;
}



Measured memory_bytes: 24844
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(a) (a).begin(), (a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x, 0, sizeof(x))
#define MINF(x) memset(x, 0x3f, sizeof(x))
#define MMINUS(a) memset(a, 0xff, sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1.0 / INF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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

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

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

using namespace std;

//===================================== template =========================================================

int N, A, B, C;
vector<int> L;

int main()
{
    string S; cin >> S;
    REP(i, S.size()) {
        if (!(i & 1)) { if (!(S[i] == 'R' || S[i] == 'U' || S[i] == 'D')) { cout << "No" << endl; return 0; } }
        else if (!(S[i] == 'L' || S[i] == 'U' || S[i] == 'D')) { cout << "No" << endl; return 0; }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#ifndef UTIL_INCLUDED
#define UTIL_INCLUDED

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
// #define DEBUGGING

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename Head, typename... Tail> const Head& var_min(const Head &head, const Tail&... tail) { return min(head, var_min(tail...)); }
template <typename Head, typename... Tail> const Head& var_max(const Head &head, const Tail&... tail) { return max(head, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }

namespace __init {

struct InitIO {
    InitIO() {
        cin.tie(0);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifndef DEBUG_FILE
#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#endif
#endif

#endif

const ll MOD = 998244353;

class Combination {
private:
    template <typename T> using V = vector<ll>;
    ll N;
    ll MOD;
    V<ll> factv, rfactv;

public:
    /*
     * MOD must be a prime number.
     */
    Combination(ll N, ll MOD)
        : N(N), 
          MOD(MOD),
          factv(N + 1, 1),
          rfactv(N + 1)
    {
        for(ll i = 1; i <= N; i++) {
            factv[i] = factv[i - 1] * i % MOD;
        }
        for(ll i = 0; i <= N; i++) {
            rfactv[i] = pow(factv[i], MOD - 2);
        }
    }

    ll fact(ll n) {
        return factv[n];
    }

    ll rfact(ll n) {
        return rfactv[n];
    }

    ll pow(ll a, ll b) {
        return b ? (b & 1 ? a : 1) * pow(a * a % MOD, b / 2) % MOD : 1;
    }

    ll comb(ll n, ll k) {
        return factv[n] * rfactv[n - k] % MOD * rfactv[k] % MOD;
    }
};

int main() {
    ll N, X;
    cin >> N >> X;

    Combination comb(1e5, MOD);
    ll ans = 0;
    for(ll one = 0; one <= N; one++) {
        for(ll two = 0; one + two <= N; two++) {
            ll cells = one + two;
            ll sum = one + 2 * two;
            if(sum == X) continue;
            if(sum < X) {
                ll tmp = comb.comb(N, cells) * comb.comb(cells, two) % MOD;
                (ans += tmp) %= MOD;
            }
            if(sum > X) {
                ll rest = sum - X;
                if(rest % 2 == 0) continue;
                ll tmp;
                if(one == 0) {
                    tmp = comb.comb(N, cells) % MOD;
                } else { 
                    ll cnt = rest / 2 + 1;
                    if(cnt * 2 > two) continue;
                    tmp = comb.comb(N, cells) * comb.comb(cells - 2 * cnt, two - 2 * cnt) % MOD;
                }
                (ans += tmp) %= MOD;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

const ll MOD = 1e9+7;
const int INF = (int)1e9+7;

// vector<tuple<long,long>> items; // (value, weight)
// auto item = items[i];
// long v = get<0>(item);
// long w = get<1>(item);
// long v, w;
//   for( int i = 0; i < N; i++ ){
//     cin >> v >> w;
//     items.push_back( make_tuple(v, w) ); // item : (value, weight)
//   }

int main(){
    int r,D,x;
    cin >> r >> D >> x;
    rep(i,10){
        cout << r * x - D << endl;
        x = r * x - D;
    }

    return 0;
}

Measured memory_bytes: 256
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N, A, B = ri_()
ans = 0
for num in range(1, N + 1):
    sm = 0
    for i in str(num):
        sm += int(i)
    if A <= sm <= B:
        ans += num
print(ans)

Measured memory_bytes: 64876
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


int main(){
    LL n, k;
    cin >> n >> k;
    vector<LL> a(n);
    for(LL i = 0; i < n; ++i){
        cin >> a[i];
    }

    for(LL i = 0; i < k; ++i){
        vector<LL> diff(n+1);
        for(LL j = 0; j < n; ++j){
            LL left = max(0LL, j - a[j]);
            LL right = min(n, 1 + j + a[j]);
            diff[left] += 1;
            diff[right] -= 1;
        }
        LL cur = 0;
        for(LL i = 0; i < n; ++i){
            cur += diff[i];
            a[i] = cur;
        }
        bool flag = true;
        for(LL i = 0; i < n; ++i){
            if(a[i] != n) flag = false;
        }
        if(flag) break;
    }

    for(LL i = 0; i < n; ++i){
        if(i+1 == n){
            cout << a[i] << endl;
        }else{
            cout << a[i] << " ";
        }
    }
    return 0;
}



Measured memory_bytes: 6052
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;

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

  cout << ((n[0] == '7' || n[1] == '7' || n[2] == '7')? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3132
import sys
input=sys.stdin.readline
k,q=map(int,input().split())
d=list(map(int,input().split()))
for _ in range(q):
  n,x,m=map(int,input().split())
  dd=[d[i]%m for i in range(k)]
  for i in range(k):
    if dd[i]==0:
      dd[i]=m
  s=x%m+sum(dd)*((n-1)//k)+sum(dd[:(n-1)%k])
  print(n-1-s//m)

Measured memory_bytes: 63836
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

/*
using PAIR = pair<string, int>;
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA() cerr << "AAAAA" << endl
#define debug_() cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll INF = 1001001001001001;
const double pi = acos(-1);

int main()
{
    int n, m;
    cin >> n >> m;
    ll SUM = 0;
    for (int i = 0; i < m; i++)
    {
        int x;
        cin >> x;
        SUM += x;
    }
    if (SUM > n)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << n - SUM << endl;
    }

    return 0;
}


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

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(ReadLine());
        }

        public static long[] Reads()
        {
            return ReadLine().Split().Select(long.Parse).ToArray();
        }


        public static long gcd(long x,long y)
        {
            if (y < x) gcd(y, x);
            while (y != 0)
            {
                var z = x % y;
                x = y;
                y = z;
            }
            return x;
        }

        public static long C(long n,long k)
        {
            long x=1;
            for (long i = 1; i <=k; i++)
            {
                x *= n - i + 1;
                x /= i;
            }
            return x;
        }
        static void Main(string[] args)
        {
            var sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            var x = Reads();
            var y = x.OrderBy(s => s).ToArray();
            long mid1 = y[y.Length/2-1];
            long mid2 = y[y.Length/2];
            for (int i = 0; i < n; i++)
            {
                if (mid1 >= x[i]) WriteLine(mid2);
                else WriteLine(mid1);
            }
            

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 45228
// https://atcoder.jp/contests/abc107/tasks/abc107_b

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int h, w;
  vector<string> a;

  cin >> h >> w;

  REP(i, h)
  {
    string ai;
    cin >> ai;
    if (ai.find('#') != string::npos)
      a.push_back(ai);
  }

  h = a.size();
  REPR(i, w - 1)
  {
    bool d = true;
    REP(j, h)
    {
      if (a[j][i] == '#')
      {
        d = false;
        break;
      }
    }
    if (d)
    {
      w--;
      REP(j, h)
      {
        a[j].erase(i, 1);
      }
    }
  }

  for (auto &aa : a)
  {
    cout << aa << '\n';
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int bit[100100];
int N, P;

void add(int k, int x)
{
    for (; k <= N + 1; k += k & -k){
        bit[k] = (bit[k] + x) % P;
    }
}

int sum(int k)
{
    int ret = 0;
    for (; k; k &= (k - 1)){
        ret = (ret + bit[k]) % P;
    }
    return (ret);
}

int main()
{
    int A, B;
    string v[100000];

    while (scanf("%d %d %d", &A, &B, &P) && A){
        memset(bit, 0, sizeof(bit));
        N = B - A + 1;
        add(N + 1, 1);
        
        for (int i = 0; i < N; i++){
            v[i] = to_string(A + i);
        }

        sort(v, v + N);

        for (int i = N - 1; i >= 0; i--){
            int pos = stoi(v[i]) - A;
            int nv = (sum(N + 1) - sum(pos) + P) % P;
            add(pos + 1, nv);
        }

       printf("%d\n", sum(N));
    }

    return (0);
}

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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long
#define lson node<<1
#define rson (node<<1)+1

const int maxn=3e6+10;
const ll mod=1e9+7;
const double pi=acos(-1);

ll qpow(ll a,ll n)
{
    ll b=1;
    while(n)
    {
        if(n&1)
            b=(b*a)%mod;
        a=a*a%mod;
        n>>=1;
    }
    return b;
}

ll ji[maxn];
void init()
{
    ji[0]=1;
    for(int i=1;i<maxn;i++)
        ji[i]=ji[i-1]*i%mod;
}

ll c(ll a,ll n)
{
    return ji[n]*qpow(ji[a],mod-2)%mod*qpow(ji[n-a],mod-2)%mod;
}

int main()
{
    init();
    ll n;
    string s;
    cin>>n>>s;
    ll k=s.length();
    ll len=k+n;
    ll ans=0;
    for(int i=1;i<=len-k+1;i++)
    {
        ans=(ans+qpow(26,i-1)*qpow(25,len-i-k+1)%mod*c(k-1,len-i)%mod)%mod;
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 28772
#include <bits/stdc++.h>
#include <chrono>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define eps 1e-9
#define f first
#define s second

typedef long long ll;

using namespace std;

const int N = 1e5;
int a[N+5];

int main()

{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, k, ans = INT_MAX;

    cin >> n >> k;

    k--;

    int arr[n];

    for (int i = 0; i < n; i++) cin >> arr[i];

    sort(arr, arr+n);

    for (int i = 0; i < n-k; i++) {

        ans = min(ans, arr[i+k]-arr[i]);
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<string>anagrams;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        anagrams.push_back(s);
    }
    sort(anagrams.begin(),anagrams.end());
    long long int power = 0;
    long long int ans = 0;
    for(int i=0;i<anagrams.size()-1;i++){
        if(anagrams[i]==anagrams[i+1]){
            power++;
        }else{
            power=0;
        }
        ans+=power;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 5748
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<fstream>
using namespace std;
int main() 
{
	long long k,a,b;
	cin>>k>>a>>b;
	if(a>=k)
	{
		cout<<1<<endl;
		return 0;
	}
	if(a<=b)
	{
		cout<<-1<<endl;
		return 0;
	}
	cout<<((k-b-1)/(a-b))*2+1<<endl;
	return 0;
}

Measured memory_bytes: 256
def exhaustiveSearch(A:list, m:int) -> str:
    if m == 0:
        return True
    if len(A) == 0 or sum(A) < m:
        return False
    return exhaustiveSearch(A[1:], m) or exhaustiveSearch(A[1:], m - A[0])
    


if __name__ == '__main__':
    n = int(input())
    A = list(map(int, input().rstrip().split()))
    q = int(input())
    M = list(map(int, input().rstrip().split()))
    for m in M:
        if exhaustiveSearch(A, m):
            print('yes')
        else:
            print('no')


Measured memory_bytes: 5624
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdarg.h>
#include<malloc.h>

int main()
{
	int i, j, a[5], buf;

	scanf("%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4]);

	for(j=4; j>0; j--){
		for(i=0; i<j; i++){
			if(a[i] < a[i+1]){
				buf = a[i];
				a[i] = a[i+1];
				a[i+1] = buf;
			}
		}
	}

	printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n; cin >> n;
    map<ll, ll> mp;
    rep(i, n) {
        ll num; cin >> num;
        mp[num / 400]++;
    }

    ll count = 0, ext = 0;
    for (auto elem : mp) {
        if (elem.first < 8) count++;
        else ext += elem.second;
    }
    if (count == 0) {
        cout << 1 << " " << ext << endl;
    } else {
        cout << count << " " << count + ext << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <numeric>
using namespace std;


int main(){
    int N,K;
    cin >> N >> K;
    K = K - 1;
    string S;
    cin >> S;

    if(S.at(K) == 'A'){
        S.at(K) = 'a';
        cout << S << endl;
    }
    else if(S.at(K)=='B'){
        S.at(K) = 'b';
        cout << S << endl;
    }
    else{
        S.at(K) = 'c';
        cout << S << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
  int N;
  cin >> N;
  
  vector<long long>A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  
  sort(A.begin(), A.end());
  
  long long ans = 0;
  
  for(int i=1;i<N;i++){
    ans += A[N-1-i/2];
  }
  
  cout << ans << endl;
  
  return 0;
}


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

int main() {
  int S, W;
  cin >> S >> W;
  if (S <= W) {
    cout << "unsafe" << endl;
  } else {
    cout << "safe" << endl;
  }
  return 0;
}





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

#define ll long long
#define mod 1000000007
#define pb push_back


int main()
{
  ll a,b,c;
  cin>>a>>b>>c;
  if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&b!=a))
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

int main (void)
{
	long n,q[10000];

	cin >> n;

	for (long i = 1; i < n + 1; i++)
	{
		if (i % 3 == 0)
		{
			cout << " " << i;
			q[i] = -1;
		}
		else if (i % 10 == 3)
		{
			cout << " " << i;
			q[i] = -1;
		}

		ostringstream p;
		p << i;
		string pp;
		pp = p.str();
		int k = 0;
		k = pp.size();
		for (int j = 0; j < k; j++)
		{
			if (pp.substr(j,1) == "3" && q[i] != -1)
			{
				cout << " " << i;
				break;
			}
		}
	}
	cout << endl;
}



Measured memory_bytes: 3288