akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
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 (a>b) { a = b; return 1; } return 0; }
void rcmb(ll *x,ll s,ll r,function<void(ll *)>f){if(r==0){f(x);}else{if(s<0)return;rcmb(x,s-1,r,f);x[r-1]=s;rcmb(x,s-1,r-1,f);}}
void cmb(ll n,ll k,function<void(ll *)>f){ll x[k];rcmb(x,n-1,k,f);}
void prm(ll n,function<void(ll *)>f){ll x[n];for(ll i=0;i<n;i++)x[i]=i;do{f(x);}while(next_permutation(x,x+n));}
void prm(ll n,ll k,function<void(ll *)>f){cmb(n,k,[&](ll *c){prm(k,[&](ll *p){ll x[k];for(ll i=0;i<k;i++){x[i]=c[p[i]];}f(x);});});}
// prm(4, 2, [](ll *x){ cout << x[0] << "," << x[1] << "\n"; });
 
int main(){
	vector<ll> S(3);
	REP(i, 3) cin >> S[i];
	ASC(S);
	cout << S[0]*S[1]/2 << "\n";
}


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

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

    for (int i = 1; i < 3; i++) {
        int d = c[i][0] - c[i - 1][0];
        for (int j = 0; j < 3; j++) {
            if (c[i][j] - c[i - 1][j] != d) {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    for (int j = 1; j < 3; j++) {
        int d = c[0][j] - c[0][j - 1];
        for (int i = 0; i < 3; i++) {
            if (c[i][j] - c[i][j - 1] != d) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		int[] c = new int[N];
		int[] d = new int[N];
		boolean[][] map1 = new boolean[2 * N][2 * N];
		boolean[][] map2 = new boolean[2 * N][2 * N];
		//1
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			map1[a[i]][b[i]] = true;
		}
		//2
		for (int i = 0; i < N; ++i) {
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
			map2[c[i]][d[i]] = true;
		}
		int ans = 0;
		for (int i = 0; i < 2 * N; ++i) {
			out: for (int j = 0; j < 2 * N; ++j) {
				if (map2[i][j]) {
					for (int k = j - 1; k >= 0; --k) {
						if (map1[i][k]) {
							map1[i][k] = false;
							++ans;
							continue out;
						}
					}
				}
			}
			if (i + 1 < 2 * N)
				for (int j = 0; j < 2 * N; ++j) {
					map1[i + 1][j] |= map1[i][j];
				}
		}
		System.out.println(ans);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 23892
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn main() {
    read_line();
    let mut v = read_line().split_whitespace().map(|x| x.parse::<i32>().unwrap()).collect::<Vec<_>>();
    v.sort();
    
    let max: f64 = v.iter().rev().enumerate()
        .map(|(i, &x)| {
            if i == v.len() - 1 {
                2_f64.powi(-(i as i32)) * (x as f64)
            } else {
                2_f64.powi(-(i as i32) - 1) * (x as f64)
            }
        })
        .sum();
    println!("{}",max);
}

Measured memory_bytes: 4352
#n=int(input())
n,m,c=map(int,input().split())
bl=list(map(int,input().split()))
al=[list(map(int,input().split())) for i in range(n)]

ans=0

for i in range(n):
    templ=al[i]
    total=c
    for j in range(m):
        total+=templ[j]*bl[j]
    if total>0:
        ans+=1

print(ans)
        



Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;


int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;


	int s, w;
	cin >> s >> w;
	if (s <= w)
	{
		cout << "unsafe" << endl;
	}
	else
	{
		cout << "safe" << endl;
	}


	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int n;
vvi maze;
vi seen;
int mxlength;
vi p;
int tmp;

int dfs(int x, int length) {
  int sz = maze.at(x).size();
  mxlength++;
  seen.at(x) = 1;
  rep(i,sz) {
    int nx = maze.at(x).at(i);
    if(!seen.at(nx)) {
      dfs(nx,length+1);
    }
  }
  return length;
}

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

  maze = vvi(n,vi());
  seen = vi(n,0);
  rep(i,m) {
    int a,b;cin >> a >> b;
    a--;b--;
    maze.at(a).eb(b);
    maze.at(b).eb(a);
  }


  int ans = 0;
  rep(i,n) {
    int length=0;
    mxlength = 0;
    if(!seen.at(i)) {
      dfs(i,length);
      ans = max(ans,mxlength);
    }
  }

  cout << ans << endl;


  return 0;


  return 0;
}


Measured memory_bytes: 27388
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll s[100100];
int main()
{
    ll i,j,k,m,n;
    ll a,b;
    ll cnt=0;
    cin>>n>>a>>b;
    cin>>s[1];
    for(i=2;i<=n;i++)
    {
        cin>>s[i];
        cnt+=min((s[i]-s[i-1])*a,b);
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 1024
N,K=map(int,input().split())
S=[0]*N
for _ in[0]*K:
 a,b=map(int,input().split())
 S[a-1]=b
dp=[0]*9
st,nd=S[:2];st-=1
if st+1:
 if nd:dp[st*3+~-nd]=1
 else:dp[st*3:st*3]=[1]*3
elif nd:dp[~-nd::3]=[1]*3
else:dp=[1]*9
for i in range(2,N):
 cur=S[i]-1;tmp=[0]*9
 if cur+1:
  for k in range(3):tmp[k*3+cur]=sum(dp[k::3])-dp[cur*4]*(k==cur)
 else:
  for cur in range(3):
   for k in range(3):tmp[k*3+cur]=sum(dp[k::3])-dp[cur*4]*(k==cur)
 dp=tmp[:]
print(sum(dp)%10000)


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

const int mod = 1000000007;

struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};

mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}

mint f(int n, int k) {
  if (n < k) return 0;
  // if (k == 0) return 1;
  return c[n][k];
}

int main() {
  init();
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    mint blue = f(k-1,i-1);
    mint red = f(n-k+1,i);
    mint ans = blue*red;
    printf("%lld\n", ans.x);
  }
  return 0;
}


Measured memory_bytes: 125568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace abc_061
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(a[2]>=a[0]&&a[2]<=a[1]?"Yes":"No");
        }
    }
}

Measured memory_bytes: 13268
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

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

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

########

N = i_inpl()
A = line_inpl(N)

max_val = max(A)
s_max = sorted(A)[-2]
max_cnt = A.count(max_val)

for Ai in A:
    if Ai == max_val and max_cnt == 1:
        print(s_max)
    else:
        print(max_val)
        

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

int dp[100010];
const int INF = 1e9;

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

    int n;
    cin >> n;
    vector<int> A;
    A.push_back(1);
    for(int i = 6; i <= n; i *= 6){
        A.push_back(i);
    }
    for(int i = 9; i <= n; i *= 9){
        A.push_back(i);
    }

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

    for(int i = 0; i <= n; i++){
        dp[i] = INF;
    }

    dp[0] = 0;
    for(int i = 1; i <= n; i++){
        for(auto x : A){
            if(i < x) break;
            dp[i] = min(dp[i], dp[i - x] + 1);
        }
    }

    cout << dp[n] << endl;




    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int ans = 1, A[100000] = {},N,in;
	bool flag = true;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> in;
		A[in]++;
	}
	for (int i = N-1; i >= 0; i-=2)
	{
		if (A[i] != 2 && i != 0)flag = false;
		else if (i == 0 && A[i] != 1)flag = false;
	}
	if (!flag)cout << 0;
	else
	{
		for (int i = 0; i < N/2; i++)
		{
			ans = ans * 2 % 1000000007;
		}
		cout << ans;
	}
}


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

typedef long long ll;
using namespace std;

ll a, b, x;

ll f(ll n){
    if(n >= 0) return n / x + 1;
    else return 0;
}

int main()
{
    cin >> a >> b >> x;
    ll ans = 0;

    ans = f(b) - f(a - 1);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;

signed main(){
    int d,n;
    cin>>d>>n;
    int m = pow(100, d);
    if(n!=100)cout<<m*n<<endl;
    else cout<<m*n+m<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void){
    char *s1,*s2;
    s1 = new char [2];
    s2 = new char [2];
    cin >> s1[0] >> s1[1];
    cin >> s2[0] >> s2[1];
    bool fmy=false,fym = false,fam=false,fna=false;
    if(((s1[0]>='1'&&s1[1]>='2')||(s1[0]<'1'))&&((s2[0]=='1'&&s2[1]<='2')||(s2[0]<'1'&&s2[1]>='1'))){
        fym = true;
    }
    if(((s2[0]>='1'&&s2[1]>='2')||(s2[0]<'1'))&&((s1[0]=='1'&&s1[1]<='2')||(s1[0]<'1'&&s1[1]>='1'))){
        fmy = true;
    }
    if(fym==true&&fmy==true){
        fam = true;
    }
    if(fym==false&&fmy==false){
        fna = true;
    }

    if(fam == true){
        cout << "AMBIGUOUS" << endl;
        return 0;
    }else if(fna == true){
        cout << "NA" <<endl;
        return 0;
    }else if(fym==true&&fmy==false){
        cout << "YYMM" << endl;
        return 0;
    }else{
        cout << "MMYY" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys
H,W = map(int, input().split())
x_pos = 0
for _ in range(H):
    a = input()
    for i in range(W):
        if i<x_pos and a[i]=="#":
            print("Impossible")
            sys.exit()
        if a[i]=="#":
            x_pos = max(x_pos, i)
print("Possible")

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
i_str = input()
stations = list(i_str)

flagA = False
flagB = False

for ss in stations:
    #print(ss)
    if ss == 'A':
        flagA = True
    elif ss == 'B':
        flagB=True

if flagA == True and flagB == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
n,m = map(int,input().split())
l1 = []
l2 = []
for _ in range(n):
	a,b = map(int,input().split())
	l1.append((a,b))
for _ in range(m):
	c,d = map(int,input().split())
	l2.append((c,d))
for a,b in l1:
	mi = 1e9
	i = 0
	for j,(c,d) in enumerate(l2):
		dist = abs(a-c)+abs(b-d)
		if dist < mi:
			mi = dist
			i = j
	print(i+1)

Measured memory_bytes: 3064
N = int(input())
a = [int(i) for i in input().split()]
mean = sum(a) / len(a)

ans = 0
diff = abs(a[0] - mean)
for i in range(1,N):
    if diff > abs(a[i] - mean):
        diff = abs(a[i] - mean)
        ans = i
print(ans)


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

int main()
{
    int a, b;
    cin >> a >> b;
    if(a < b){
        for(int d=0; d<b; d++){
            cout << a;
        }
        cout << endl;
    } else {
        for(int d=0; d<a; d++){
            cout << b;
        }
        cout << endl;
    }
	return 0;
}


Measured memory_bytes: 256
x, n = map(int, input().split())

if n == 0:  
    p = input()
    print(x)
else:
    p = list(map(int, input().split()))
    max_p = max(p)
    ans = 0
    tmp = 1000

    for i in range(111):
        diff = abs(x - i)
        if i not in p and tmp > diff:
            ans = i
            tmp = diff

    print(ans)


Measured memory_bytes: 9188
{
  const main = (input: string) => {
    const r = reader(input)
    const N = r.n()
    const S = r.s()
    const d1: { [d: string]: boolean } = {}
    const d2: { [d: string]: boolean } = {}
    const d3: { [d: string]: boolean } = {}
    const d1a: string[] = []
    const d2a: string[] = []
    let res = 0

    S.split('').forEach(c => {
      d2a.forEach(a => {
        if (!d3[a + c]) {
          d3[a + c] = true
          res++
        }
      })
      d1a.forEach(a => {
        if (!d2[a + c]) {
          d2[a + c] = true
          d2a.push(a + c)
        }
      })
      if (!d1[c]) {
        d1[c] = true
        d1a.push(c)
      }
    })

    console.log(res)
  }

  // const values = obj => Object.keys(obj).map(e => obj[e]);

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const line = s
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    return { lines, line, s, n, ss, ns }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  main(getInput())
}


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

using namespace std;

#define ll long long
#define fix cout << fixed; cout << setprecision(10)





void solve() {

	int n, k;
	cin >> n >> k;
	int arr[n];
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	ll sum = 0;
	for(int i = 0; i < n - k; i++) {
		sum += arr[i];

	}
	cout << sum << "\n";
	




	
}

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	
	solve();

	return 0;
}

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

typedef long long ll;

const ll MIN = -1000000000000000000;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		p[i]--;
	}
	vector<int> c(n);
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	ll answer = MIN;
	vector<bool> vis(n);
	for (int i = 0; i < n; i++) {
		if (vis[i]) continue;
		vis[i] = true;
		vector<int> s;
		s.push_back(c[i]);
		int nxt = p[i];
		while (!vis[nxt]) {
			vis[nxt] = true;
			s.push_back(c[nxt]);
			nxt = p[nxt];
		}
		int sz = s.size();
		vector<ll> m(sz + 1, MIN);
		vector<ll> pre(sz + 1);
		for (int j = 1; j <= sz; j++) {
			pre[j] = pre[j - 1] + s[j - 1];
		}
		vector<ll> lessm(sz + 1, MIN);
		for (int len = 1; len <= sz; len++) {
			m[len] = pre[len];
			for (int end = len + 1; end <= sz; end++) {
				m[len] = max(m[len], pre[end] - pre[end - len]);
			}
			for (int start = 1; start < len; start++) {
				m[len] = max(m[len], pre[start] + pre[sz] - pre[sz - (len - start)]);
			}
			lessm[len] = max(lessm[len - 1], m[len]);
		}
		if (k >= sz && m[sz] <= 0) {
			answer = max(answer, lessm[sz]);
			continue;
		}
		if (k < sz) {
			answer = max(answer, lessm[k]);
			continue;
		}
		int max_cyc = k/sz;
		answer = max(answer, max_cyc * m[sz] + lessm[k - max_cyc * sz]);
		if (k - ((max_cyc - 1) * sz) <= sz)
			answer = max(answer, (max_cyc - 1) * m[sz] + lessm[k - (max_cyc - 1) * sz]);
		else
			answer = max(answer, (max_cyc - 1) * m[sz] + lessm[sz]);
		//for (int cyc = 0; cyc <= max_cyc; cyc++) {
			//if (k - cyc * sz > sz) {
				//answer = max(answer, lessm[sz] + cyc * m[sz]);
			//} else {
				//answer = max(answer, lessm[k - cyc * sz] + cyc * m[sz]);
			//}
		//} 
	}
	cout << answer << endl;
}


Measured memory_bytes: 3768
a=input()
dic={}
for i in range(len(a)):
  if a[i] in dic:
    dic[a[i]]+=1
  else:
    dic[a[i]]=1
if len(dic)==2:
  my=True
  for i in dic.values():
    if i!=2:
      my=False
  if my:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 3064
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N,M,C = MI()
B = LI()
ans = 0
for i in range(N):
    A = LI()
    a = C
    for j in range(M):
        a += A[j]*B[j]
    if a > 0:
        ans += 1
print(ans)


Measured memory_bytes: 62216
#include<iostream>
#include<string>
using namespace std;
int main()
{
string a,b;
cin>>a>>b;
if(a.size()>b.size()){
cout<<"GREATER"<<endl;
}
if(a.size()<b.size()){
cout<<"LESS"<<endl;
}
if(a.size()==b.size()){
for(int i=0;i<a.size();i++){
if(a[i]>b[i]){
cout<<"GREATER"<<endl;
break;
}
if(a[i]<b[i]){
cout<<"LESS"<<endl;
break;
}
if(a[i]==b[i]){
cout<<"EQUAL"<<endl;
break;
}
}
}
return 0;
}

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

int main() {
  string s; cin >> s;
  if(s[0] != s[1] && s[1] != s[2] && s[2] != s[3])
    cout << "Good" << endl;
  else
    cout << "Bad" << endl;
}

Measured memory_bytes: 3600
//Keep Working Hard
  // I__Like__Food  
  #include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 200005
  #define INF 1000000000000
  #define eps 1e-6
  #define int long long
  #define pie 3.1415926535897932384626433832795028
int32_t main()
{




    int n;
    cin >> n;

    double ans = 2 * pie * n;

    cout << fixed << setprecision(10) << ans;
    return 0;
}


Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int LCM(int a, int b) { int g = gcd(a, b); return a / g * b; }
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    VI a(n); VIin(a);
    VI l(n) , r(n);
    l[0] = a[0];
    r[n-1] = a[n-1];
    FOR(i,1,n){
        l[i] = gcd(l[i-1],a[i]);
        r[n-i-1] = gcd(r[n-i],a[n-i-1]);
    }
    int ans = max(r[1],l[n-2]);
    FOR(i,1,n-1) ans = max(gcd(l[i-1],r[i+1]),ans);
    ANS;
    
    return 0;
}

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

int main(void) {
    string s;cin>>s;
    vector<char> vc;
    for (int i = 0 ; i < s.size(); i++) {
        char v = s[i];
        if (v != 'B') {
            vc.push_back(v);
        } else {
            if (vc.size() > 0) vc.pop_back();
        }
    }
    for (int i = 0; i < vc.size(); i++) {
        printf("%c", vc.at(i));
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define vi vector <int>
#define pi pair <int, int>

vector <vi> adj;
vi visited;
int n, m;

void input()
{
	int x, y, z;
	cin >> n >> m;
	adj.resize(n + 1);
	visited.resize(n + 1);
	for (int i = 1; i <= m; i++)
	{
		cin >> x >> y >> z;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
}

void dfs(int cur)
{
	visited[cur] = true;
	for (int i: adj[cur])
		if (!visited[i])
			dfs(i);
}

int main()
{
	input();
	int count = 0;
	for (int i = 1; i <= n; i++) 
		if (!visited[i]) {dfs(i); count++;}
	cout << count;
}

Measured memory_bytes: 9216
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0)
#define END return EXIT_SUCCESS
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR(I,0,N)
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP(I,N) cin>>V[I]
#define INS2(I,N,V1,V2) REP(I,N) cin>>V1[I]>>V2[I];
#define INS3(I,N,V1,V2,V3) REP(I,N) cin>>V1[I]>>V2[I]>>V3[I];
#define OUT(P) cout<<P<<endl
#define OUT2(P1,P2) cout<<P1<<" "<<P2<<endl
#define OUT3(P1,P2,P3) cout<<P1<<" "<<P2<<" "<<P3<<endl
#define OUTS(I,N,V) REP(I,N) cout<<V[i]<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
typedef unsigned long ul;
typedef unsigned int ui;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long ans;
long N,A,X,i,j,k,s;
vector<long> x;
long dp[51][51][2501];

inline void solve(){
  IN2(N,A);
  x.resize(N+1);
  REP(i,N){
    IN(x[i+1]);
  }
  X=50;
  dp[0][0][0]=1;
  UP(j,1,N){
    UP(k,0,j){
      UP(s,0,50*k){
        if(s<x[j])dp[j][k][s]=dp[j-1][k][s];
        else dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[j]];
      }
    }
  }
  UP(k,1,N)ans+=dp[N][k][k*A];
  OUT(ans);
}

int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 48640
// Problem : C - gacha
// Contest : AtCoder - AtCoder Beginner Contest 164
// URL : https://atcoder.jp/contests/abc164/tasks/abc164_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
/* Author:bhagatsunny96
         JGEC
	   template__
	lets_code_it_ */
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long int 
#define ld long double
#define fi first
#define se second
#define mod 1000000007
#define test long long int t; cin>>t; while(t-->0)
#define fIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define loop(n) for(long long int i=0;i<n;i++)
#define loopr(n) for(long long int i=n-1;i>=0;i--)
#define lrp(a,b) for(long long int i=a;i<=b;i++)
#define lrn(a,b) for(long long int i=b;i>=a;i--)
#define endl '\n'
#define ivec vector<ll>
#define ivecp vector<pair<ll,ll>>
#define imap map<ll,ll>
#define uimap unordered_map<ll,ll>
#define iset set<ll>
#define cvec vector<char>
#define civecp vector<pair<char,ll>>
#define cimap map<char,ll>
#define ucimap unordered_map<char,ll>
#define cset set<char>
using namespace std;
ll gcd(ll a, ll b)
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);
}
ll lcm(ll a, ll b)  
 {  
    return (a*b)/__gcd(a, b);  
 }
 ll power(ll x, unsigned ll y) 
 { 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
 }
 bool isPrime(ll num)
 {
    bool flag=true;
    for(ll i =2;i<=num/2;i++) 
    {
       if(num%i==0) 
       {
          flag=false;
          break;
       }
    }
    return flag;
}
bool isPalin(ll num)
{
    bool flag=false;
    ll digit,rev=0,n=num;
    do
     {
         digit = num % 10;
         rev = (rev * 10) + digit;
         num = num / 10;
     } while (num != 0);
     if(rev==n)
     flag=true;
     return flag;
}
ll sumofdigits(ll n)
{
    ll c=0;
    while(n>0)
    {
        c++;
        n/=10;
    }
    return c;
}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b) 
{ 
    return (a.first > b.first); 
}
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}
string sortString(string &str) 
{ 
   sort(str.begin(), str.end()); 
   return str;
} 
void countSort(ll arr[], ll n, ll exp) 
{ 
	ll output[n];
	ll i, count[10] = {0}; 
	for (i = 0; i < n; i++) 
		count[ (arr[i]/exp)%10 ]++; 
	for (i = 1; i < 10; i++) 
		count[i] += count[i - 1]; 
	for (i = n - 1; i >= 0; i--) 
	{ 
		output[count[ (arr[i]/exp)%10 ] - 1] = arr[i]; 
		count[ (arr[i]/exp)%10 ]--; 
	} 
	for (i = 0; i < n; i++) 
		arr[i] = output[i]; 
} 
void radixsort(ll arr[], ll n) 
{
    ll mx = arr[0]; 
	for (ll i = 1; i < n; i++) 
		if (arr[i] > mx) 
			mx = arr[i];
	ll m =mx;
	for (ll exp = 1; m/exp > 0; exp *= 10) 
		countSort(arr, n, exp); 
} 
void print(ll arr[], ll n) 
{ 
    for (ll i = 0; i < n; i++) 
        cout << arr[i] << " "; 
}
int main()
{
	fIO
	ll n;
	string s;
	map<string,ll>mx;
	cin>>n;
	loop(n)
	{
		cin>>s;
		mx[s]++;
	}
	cout<<mx.size()<<endl;
	return 0;
}




Measured memory_bytes: 19280
n = int(input())
x = list(map(int, input().split()))

ans = float("inf")

for i in range(min(x), max(x)+1):
    power = 0
    for j in range(len(x)):
        power += (x[j] - i) ** 2
    ans = min(ans, power)
print(ans)
        



Measured memory_bytes: 2940
// Submitted By Subhash Yadav
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

//
//300000 300000 1
//3 4
import java.util.*;

public class Main {
	static long hash(int x, int y) {
		return x * 1_000_000_000l + y;
	}

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int h = sc.nextInt(), w = sc.nextInt(), m = sc.nextInt();
		HashSet<Long> set = new HashSet<>();
		ArrayDeque<Integer> a1 = new ArrayDeque<>();

		int row[] = new int[h + 1];
		int col[] = new int[w + 1];
		long maxx = Long.MIN_VALUE, maxy = Long.MIN_VALUE;
		long count = 0;
		for (int i = 0; i < m; i++) {
			int x = sc.nextInt(), y = sc.nextInt();
			set.add(hash(x, y));

			row[x]++;
			col[y]++;
			maxx = Math.max(row[x], maxx);
			maxy = Math.max(col[y], maxy);
		}

		ArrayList<Integer> candidateXS = new ArrayList<>();
		ArrayList<Integer> candidateYS = new ArrayList<>();

		for (int i = 1; i <= h; i++) {

			if (maxx == row[i])
				candidateXS.add(i);

		}
		
		for(int j=1;j<=w;j++) if(maxy==col[j]) candidateYS.add(j);
		
		long ans=maxx+maxy-1;
		
		
		outer: for(int i:candidateXS) {
			for(int j:candidateYS) {
				if(!set.contains(hash(i, j))) {
					ans++;
					break outer;
				}
			}
		}
		

		

		System.out.println(ans);

		out.close();

	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 88584
from collections import Counter
n, m = map(int, input().split())
alst = list(map(int, input().split()))
acc = 0
acc_alst = []
for a in alst:
  acc += a
  acc %= m
  acc_alst.append(acc)

count = Counter(acc_alst)
ans = 0
for k, v in count.items():
  if k == 0:
    ans += v
  if v >= 2:
    ans += v * (v - 1) // 2
print(ans)

Measured memory_bytes: 17368
from collections import Counter

N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
a = Counter(s)
a = a.most_common()


ans = 0
for i in a:
  if i[0] not in t:
    ans = max(i[1],ans)

  elif i[0] in t:
    ans = max(i[1] - t.count(i[0]),ans)


print(ans)

Measured memory_bytes: 3316
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [0 for n in range(N)]
inf = 10**10
for i in range(1, N):
	dp[i] = inf
	for k in range(max(0, i-K), i):
		dp[i] = min(dp[i], dp[k] + abs(H[i] - H[k]))
# print(dp)
print(dp[N-1])


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

int main() {
    int n;
    cin >> n;
    vector<tuple<string, int , int>> p;

    for (int i = 0; i < n; i++) {
        string name;
        int sco;
        cin >> name >> sco;
        //p = make_pair(sco, name);
        sco *= -1;
        p.push_back(make_tuple(name, sco,  i + 1));
    }

    sort(p.begin(), p.end());
    //reverse(p.begin(), p.end());
    for (tuple<string, int , int> t :p) {
        int sco , i;
        string s;
        tie(s, sco, i) = t;
        cout << i << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {}

class C {
 public:
  int N, a, factor4 = 0, factor2 = 0, factor1 = 0;
  ~C() {
    cin >> N;
    while (N--) {
      cin >> a;
      if (a % 2 == 0) {
        if (a % 4 == 0)
          ++factor4;
        else
          ++factor2;
      } else {
        ++factor1;
      }
    }
    if (factor2 == 0) {
      if (factor1 <= factor4 + 1)
        cout << "Yes" << endl;
      else
        cout << "No" << endl;
    } else {
      if (factor1 <= factor4)
        cout << "Yes" << endl;
      else
        cout << "No" << endl;
    }
  }
} x;


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

struct city
{
    int p, y, i;
    bool operator < (const city &rhs)const
    {
        if(p == rhs.p)
        {
            return y < rhs.y;
        }
        return p < rhs.p;
    }
};

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<city> c(m);
    vector<string> id(m);
    for(int i = 0; i < m; i++)
    {
        cin >> c[i].p >> c[i].y;
        c[i].i = i;
    }
    sort(c.begin(), c.end());
    int cnt = 1;
    for(int i = 0; i < m; i++)
    {
        if(i > 0 && c[i].p > c[i - 1].p)
        {
            cnt = 1;
        }
        string idf = to_string(c[i].p);
        string idb = to_string(cnt);
        while(idf.size() != 6)
        {
            idf = '0' + idf;
        }
        while(idb.size() != 6)
        {
            idb = '0' + idb;
        }
        id[c[i].i] = idf + idb;
        cnt++;
    }
    for(int i = 0; i < m; i++)
    {
        cout << id[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 8192
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(v) v.begin(),v.end()
#define mod 1000000007


int main(){
  string s;
  ll a[10]={0};
  rep(i,5){
    cin >> a[i];
  }
  ll k;
  cin >>k;
  ll n,q;
  string ans="Yay!";
  sort(a,a+5);
  if(abs(a[4]-a[0])>k){
    ans=":(";
  }


  cout << ans << endl;

}


Measured memory_bytes: 256
#include <cstdio>
#include <numeric>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
#include <deque>
#include <cassert>

using namespace std;

#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); i++)
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define sqrt(x) sqrt(abs(x))
#define y0 y3487465
#define y1 y8687969
#define fill(x,y) memset(x,y,sizeof(x))
#define prev PREV
                         
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef double D;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;

template<class T> T abs(T x) { re x > 0 ? x : -x; }

ll a, b, c, n;

int main () {
	cin >> a >> b >> c >> n;
	if (n % 2 == 0) cout << a - b << endl; else cout << b - a << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int[] a = new int[]{sc.nextInt(), sc.nextInt()};
            if (a[0] == 0 && a[1] == 0) {
                break;
            }
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < a[0]; i++) {
                for (int j = 0; j < a[1]; j++) {
                    if (i % 2 == 0 && j % 2 == 1 || i % 2 == 1 && j % 2 == 0) {
                        sb.append(".");
                    } else {
                        sb.append("#");
                    }
                }
                sb.append("\n");
            }
            System.out.println(sb.toString());
        }
    }
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

std::string daysOfWeek[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};

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

  std::string S;
  std::cin >> S;

  int res = 7 - (std::find(daysOfWeek, daysOfWeek + 7, S) - daysOfWeek);
  std::cout << res << std::endl;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    
    total = 0
    ans_a0_plus = 0
    for i in range(n):
        if i % 2 == 0:#plus
            if total + a[i] > 0:
                total = total + a[i]
            else:
                ans_a0_plus += 1 - (total + a[i])
                total = 1
        else:#minus
            if total + a[i] < 0:
                total = total + a[i]
            else:
                ans_a0_plus += 1 + (total + a[i])
                total = -1
    
    total = 0
    ans_a0_minus = 0
    for i in range(n):
        if i % 2 == 0:#minus
            if total + a[i] < 0:
                total = total + a[i]
            else:
                ans_a0_minus += 1 + (total + a[i])
                total = -1
        else:#plus
            if total + a[i] > 0:
                total = total + a[i]
            else:
                ans_a0_minus += 1 - (total + a[i])
                total = 1
    
    print(min(ans_a0_plus, ans_a0_minus))

Measured memory_bytes: 14468
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int abcd[4];
int temp;

void dfs() {
    const int n = 4;
    REP(i, pow(2, n)) {
        int sum = 0;
        string ops;

        REP(j, n) {
            if ((1 & i >> j) == 1) {
                sum += abcd[j];
                ops += '+';
            } else {
                sum -= abcd[j];
                ops += '-';
            }
        }
        if (sum == 7) {
            cout << to_string(abcd[0]) + ops[1] + to_string(abcd[1]) + ops[2] + to_string(abcd[2]) +
                    ops[3] + to_string(abcd[3]) + "=7" << endl;
            return;
        }
    }
}

void solve() {
    dfs();
}

int main() {
    cin >> temp;
    abcd[0] = temp / 1000;
    abcd[1] = (temp - abcd[0] * 1000) / 100;
    abcd[2] = (temp - abcd[0] * 1000 - abcd[1] * 100) / 10;
    abcd[3] = (temp - abcd[0] * 1000 - abcd[1] * 100 - abcd[2] * 10) / 1;
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define vec2 vector<vector<lli>>
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define FRE freopen("explicit.in","r",stdin);freopen("explicit.out","w",stdout)
#define pll pair <lli,lli>
#define vll vector <lli>
#define vpll vector <pll>
#define f first
#define s second
#define pb push_back
#define priq priority_queue
#define unm unordered_map
#define pf push_front
#define minii LLONG_MAX
#define all(x) x.begin(), x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define ld double
#define eb emplace_back
const long double pi = 3.1415926535898;
const lli mod=1e9+7;
//const lli mod=100000000;
using namespace std;
lli lcm (lli a, lli b) {return ((a*b)/__gcd(a,b));}
lli modpower (lli a,lli b)
{
    if(b==0) return 1;
    lli c=modpower(a,b/2)%mod;
    if (b%2) return (((a*c)%mod)*c)%mod;
    else return (c*c)%mod;
}
lli power (lli a,lli b)
{
    if(b==0) return 1;
    lli c=power(a,b/2);
    if (b%2) return (a*c*c);
    else return c*c;
}
bool prime (lli k)
{
    if (k==1||k==0) return 0;
    bool flag=1;
    lli a=sqrt(k);
    for (int i=2;i<=a;i++)
    {
        if (k%i==0)
        {flag=0;break;}
    }
    return flag;
}
lli sieve (int n)
{
    bool qrr[n+1];
    for (int i=0;i<=n;i++)
    qrr[i]=1;qrr[0]=0;qrr[1]=0;
    for (int i=2;i*i<=n;i++)
    {
        if (qrr[i]==1)
        {
            for (int j=2*i;j<=n;j+=i)
            {qrr[j]=0;}
        }
    }
    return 0;
}
int main()
{
    fio;
    lli n;
    cin>>n;
    lli sum=0;
    bool f=0;
    lli x,y;
    for (int i=0;i<n;i++)
    {
        cin>>x>>y;
        if (x==y)
        sum++;
        else
        sum=0;
        if (sum>=3)
        f=1;
    }
    if (f)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}

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

int main(){
   long long int a,b,x;cin>>a>>b>>x;
   long long acnt;
   if(a!=0)acnt=(a-1)/x+1;
   else acnt=0;
   long long bcnt=b/x+1;
   cout<<bcnt-acnt<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int k,n;
int a[1000005]; 
int main()
{
	scanf("%d%d",&k,&n);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]),a[i+n]=a[i]+k;
	int ans=1000000000;
	for(int i=1;i<=n;++i)ans=min(ans,a[i+n-1]-a[i]);
	printf("%d\n",ans);
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long int
#define pi pair<int,int>
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second 
#define endl '\n'
#define dbg(x) cout<<#x<<" "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int mod = 1e9+7;
const double PI = acos(-1.0);
const int MAXN = 1e6+5;

void cp()
{
	int a,b;
	cin>>a>>b;
	cout<<a*b;
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;
 
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;
 
int n, m, q;
int sum[501][501];
 
int main() {
  cin >> n >> m >> q;
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    sum[l][r] += 1;
  }
 
  rep(i, n) {
    rep(j, n) {
      sum[i+1][j+1] += sum[i+1][j];
    }
  }
 
  /**
  rep(i, n+1) {
     rep(j, n+1) {
       cout << sum[i][j] << " ";
     }
     cout << endl;
  }
  **/
 
  int ans[100000] = {0};
 
  rep(i, q) {
    int l, r;
    cin >> l >> r;
    for(int j = l; j <= r; j++) {
      ans[i] += sum[j][r];
    }
  }
 
  rep(i, q) {
  	cout << ans[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;

struct position{
  position(int x,int y){
    this->x = x;
    this->y = y;
  }
  int diff(position p){
    int tx = x - p.x;
    int ty = y - p.y;
    int r = abs(tx) + abs(ty);
    return r;
  }
  int x,y;
};

int main() {
  int N;
  cin >> N;
  int mp = 1000000000;
  
  position en(1,1);
  position wn(mp,1);
  position es(1,mp);
  position ws(mp,mp);
  
  vector<position>vp;
  for(int i = 0;i < N;++i){
    int x,y;
    cin >> x;
    cin >> y;
    vp.push_back(position(x,y));
    if(en.x < x){
      en.x = x;
    }
    if(en.y < y){
      en.y = y;
    }
    if(ws.x > x){
      ws.x = x;
    }
    if(ws.y > y){
      ws.y = y;
    }
  }
  wn.x = ws.x;
  wn.y = en.y;
  es.x = en.x;
  es.y = ws.y;
  
  int enc = -1;
  int esc = -1;
  int wnc = -1;
  int wsc = -1;
  int enm = -1;
  int esm = -1;
  int wnm = -1;
  int wsm = -1;
  
  for(int i = 0;i < N;++i){
    int t = en.diff(vp[i]);
    if(enc == -1 || enm > t){
      enc = i;
      enm = t;
    }

    t = es.diff(vp[i]);
    if(esc == -1 || esm > t){
      esc = i;
      esm = t;
    }

    t = ws.diff(vp[i]);
    if(wsc == -1 || wsm > t){
      wsc = i;
      wsm = t;
    }

    t = wn.diff(vp[i]);
    if(wnc == -1 || wnm > t){
      wnc = i;
      wnm = t;
    }

  }
  
  int a = vp[enc].diff(vp[wsc]);
  int b = vp[esc].diff(vp[wnc]);
  cout << (a > b ? a : b) << endl;
}


Measured memory_bytes: 5344
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

bool b[100010];
ll dp[100010];
int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a;
		cin >> a;
		b[a] = true;
	}
	dp[0] = 1;
	if (b[1]) dp[1] = 0;
	else dp[1] = 1;
	if (b[2]) dp[2] = 0;
	else dp[2] = dp[0] + dp[1];
	for (int i = 3; i <= N; i++) {
		if (b[i]) dp[i] = 0;
		else dp[i] = (dp[i - 2] + dp[i - 1]) % mod;
	}
	cout << dp[N] << endl;
}

Measured memory_bytes: 4496