akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define int long long

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	string str;
	cin>>str;
	int count = 0;

	
	if(str[0] == 'R' and str[1] == 'R' and str[2] =='R'){
		count += 3;
	}

	if(str[0] == 'R' and str[1] == 'R' and str[2] == 'S'){
		count += 2;
	}

	if(str[0] == 'R' and str[1] == 'S' and str[2] == 'S'){
		count += 1;
	}

	if(str[0] =='R' and str[1] == 'S' and str[2] == 'R'){
		count += 1;
	}

	if(str[0] =='S' and str[1] == 'S' and str[2] == 'R'){
		count += 1;
	}

	if(str[0] =='S' and str[1] == 'R' and str[2] == 'R'){
		count += 2;
	}

	if(str[0] =='S' and str[1] == 'R' and str[2] == 'S'){
		count += 1;
	}
		
	cout<<count;

	return 0;
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





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

    int n;
    cin>>n;
    pair<int,int> mx;
    for (int i=0; i<n; i++) {
	int a,b;
	cin>>a>>b;
	mx=max(mx, {a,b});
    }

    cout<<mx.first+mx.second<<endl;
    
    
    return 0;
}


Measured memory_bytes: 3624
import math


def solve(k):
    res = 0
    for a in range(1, k + 1):
        for b in range(1, k + 1):
            d = math.gcd(a, b)
            for c in range(1, k + 1):
                res += math.gcd(c, d)
    return res


def main():
    k = int(input())
    res = solve(k)
    print(res)


def test():
    assert solve(2) == 9
    assert solve(200) == 10813692


if __name__ == "__main__":
    # test()
    main()


Measured memory_bytes: 9192
#include<stdio.h>
int a[512],b[512];
int dp[700][700];
bool vis[1024];
int f[700][700],g[700][700];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	n<<=1;
	for(int i=0;i<k;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		vis[a[i]]=true;
		vis[b[i]]=true;
	}
	for(int l=1;l<=n;l++)
	{
		for(int r=l;r<=n;r++)
		{
			bool ok=true;
			for(int i=0;i<k;i++)
			{
				if((a[i]>=l&&a[i]<=r)^(b[i]>=l&&b[i]<=r))
				{
					ok=false;
					break;
				}
			}
			if(!ok)
			{
				continue;
			}
			int num1=0,num2=0;
			for(int i=1;i<=n;i++)
			{
				if(vis[i])
				{
					continue;
				}
				if(i>=l&&i<=r)
				{
					num1++;
				}
				else
				{
					num2++;
				}
			}
			if((num1&1)||(num2&1))
			{
				continue;
			}
			f[l][r]=1;
			for(int i=1;i<=num1;i+=2)
			{
				f[l][r]=(long long)f[l][r]*i%1000000007;
			}
			g[l][r]=1;
			for(int i=1;i<=num2;i+=2)
			{
				g[l][r]=(long long)g[l][r]*i%1000000007;
			}
		}
	}
	int ans=0;
	for(int l=1;l<=n;l++)
	{
		for(int r=l;r<=n;r++)
		{
			dp[l][r]=f[l][r];
			for(int i=l;i<r;i++)
			{
				dp[l][r]-=(long long)dp[l][i]*f[i+1][r]%1000000007;
				if(dp[l][r]<0)
				{
					dp[l][r]+=1000000007;
				}
			}
			ans+=(long long)dp[l][r]*g[l][r]%1000000007;
			if(ans>=1000000007)
			{
				ans-=1000000007;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    double t, x;
    cin >> t >> x;

    OP(t / x);
    return 0;
}

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

int main(){
  int N;  cin >> N;
  long long int L0 = 2;
  long long int L1 = 1;
  long long int L2;
  for(int i = 0;i < N-1;i++){
      L2 = L1 + L0;
      L0 = L1;
      L1 = L2;//N番目のリュカ数がL1に入る.
  }

  cout << L1 << endl;

}


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

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

	int N;
	cin >> N;

	long long int whole = 0; //バームクーヘンの大きさ
	int* A = new int[N];
	for (int i = 0; i < N; i++){
		cin >> A[i];
		whole += (long long int)A[i];
	}

	long long int one_third = whole / 3;

	int ini = 0;
	long long int piece1 = 0;
	while (piece1 + (long long int)A[ini] <= one_third){
		piece1 += (long long int)A[ini];
		ini++;
	}
	
	int piece2_i = ini;
	long long int piece2 = 0;
	while (1){
		piece2 += (long long int)A[ini];
		ini++;
		if (piece2 >= piece1) break;
	}
	
	int piece3_i = ini;
	long long int piece3 = whole - piece1 - piece2;
	long long int ans = min(piece1, piece3);

	for (int i = 1; i < N; i++){
		if (piece1 == 0){
			piece2 -= (long long int)A[piece2_i];
			piece2_i++;
		}
		else piece1 -= (long long int)A[i-1];

		while (piece1 + (long long int)A[piece2_i] <= one_third){
			piece1 += (long long int)A[piece2_i];
			piece2 -= (long long int)A[piece2_i];
			piece2_i++;
			if (piece2_i == N) piece2_i -= N; //周期的境界条件
		}

		while (piece2 < piece1){
			piece2 += (long long int)A[piece3_i];
			piece3_i++;
			if (piece3_i == N) piece3_i -= N; //周期的境界条件
		}

		piece3 = whole - piece1 - piece2;
		ans = max(ans, min(piece1, piece3));
	}

	cout << ans << endl;

	delete[] A;
	return 0;
}

Measured memory_bytes: 1532
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int n;
int m;

vi a;

void input() {
  cin >> n >> m;

  a.resize(n);
  for (auto&& i : a)
    cin >> i;
}

void solve() {
  int sum = 0;

  for (auto&& i : a)
    sum += i;

  int need = (sum + 4 * m - 1) / (4 * m);
  int cnt = 0;

  for (auto&& i : a)
    cnt += i >= need;

  string ans = "Yes";

  if (cnt < m)
    ans = "No";

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

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  _times = 3;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3628
n = gets.chomp.to_i

arr = Array.new(10).map{Array.new(10, 0)}

1.upto(n) do |i|
  s = i.to_s

  arr[s[0].to_i][s[-1].to_i] += 1
end

ans = 0
1.upto(9) do |i|
  1.upto(9) do |j|
    ans += arr[i][j] * arr[j][i]
  end
end

p ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define DUMP(x) cout << #x << " = " << (x) << endl
#define MP make_pair
#define PB push_back
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> PII;

int main() {
  int n; cin >> n;
  VI a(n);
  REP(i, n) cin >> a[i];
  int mxPos = (int)(max_element(a.begin(), a.end()) - a.begin());
  int miPos = (int)(min_element(a.begin(), a.end()) - a.begin());
  int mx = a[mxPos];
  int mi = a[miPos];
  cout << n * 2 - 1 << endl;
  if (abs(mx) >= abs(mi)) {
    REP(i, n) {
      cout << mxPos + 1 << " " << i + 1 << endl;
    }
    REP(i, n - 1) {
      cout << i + 1 << " " << i + 2 << endl;
    }
  } else {
    REP(i, n) {
      cout << miPos + 1 << " " << i + 1 << endl;
    }
    for (int i = n - 1; i > 0; --i) {
      cout << i + 1 << " " << i << endl;
    }
  }
  return 0;
}

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

vector<int> getPath(vector<vector<int>>& es){
  int n = es.size();
  int s = 0,t = n-1;
  
  queue<int> que;
  vector<int> prev(n,-1);
  prev[s] = 1;
  que.push(s);
  while(!que.empty()){
    int now = que.front();que.pop();
    for(int i=0;i<es[now].size();i++){
      int nxt = es[now][i];
      if(prev[nxt] != -1)continue;
      prev[nxt] = now;
      que.push(nxt);
    }
  }
  vector<int> path;
  path.push_back(t);
  int now = t;
  while(now != s) {
    now = prev[now];
    path.push_back(now);
  }
  reverse(path.begin(),path.end());
  return path;
}

int main(void) {
  int N;
  cin >> N;
  vector<vector<int>> es(N);
  for(int i=0;i<N-1;i++){
    int a,b;
    cin >> a >> b;
    a--;b--;
    es[a].push_back(b);
    es[b].push_back(a);
  }

  // 相手の方に近づく方向に塗るだけ
  vector<int> color(N);
  color[0] = 1;
  color[N-1] = -1;

  vector<int> path = getPath(es);
  for(int t=0;t<path.size();t++){
    if(t%2==0)
      color[path[t/2]] = 1;
    else
      color[path[path.size()-1-t/2]] = -1;
  }

  int cc = 0;
  if(path.size() % 2 == 0) cc = 1;
  else cc = -1;

  vector<int> cnt(2);
  for(int c=-1;c<=1;c+=2){
    queue<int> que;
    vector<int> used(N);
    int s;
    if(c==-1) s = N-1;
    else s = 0;
    
    used[s] = 1;
    que.push(s);
    while(!que.empty()){
      int now = que.front();que.pop();
      if(color[now] )
      for(int i=0;i<es[now].size();i++){
        int nxt = es[now][i];
        if(used[nxt] != 0)continue;
        if(color[nxt] == 0) {
          color[nxt] = c;
          
          if(c==-1) cnt[1]++;
          else cnt[0]++;
          que.push(nxt);
        }else if(color[nxt] == c){
          used[nxt] = 1;
          que.push(nxt);
        }
      }
    }
  }
  cerr << cc << endl;
  cerr << cnt[0] << endl;
  cerr << cnt[1] << endl;

  if(cc == 1){
    if(cnt[0] > cnt[1])cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
  } else {
    if(cnt[1] > cnt[0])cout << "Snuke" << endl;
    else cout << "Fennec" << endl;
  }

  // cerr << 'a';
  // for(int i=0;i<path.size();i++){
  //   cerr << color[path[i]] << endl;
  // }

  return 0;
}

Measured memory_bytes: 7164
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int e;
    while(scanf("%d",&e),e){
        int m=1<<25;
        for(int i=0;i*i*i<=e;i++){
            for(int j=0;i*i*i+j*j<=e;j++){
                int val=i*i*i+j*j;
                m=min(m,i+j+(e-val));
            }
        }
        printf("%d\n",m);
    }
    return 0;
}

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


int main()
{
  	int N;
	cin >> N;
	vector <float> v(N);
	float answer;
	rep (i,N){
		cin >> v.at(i);
	}
	sort(v.begin(), v.end());
	answer = v[0];
	for (int i=1;i<N;i++){
		answer = (answer + v[i])/2;
	}
	cout << std::setprecision(10) << answer << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())

cl = []

for i in range(n):
    cl.append(int(input()))


ans = [1 for i in range(n)]

mod = 10**9+7

stones = dict()

stones[cl[-1]] = n-1

for i in range(n-1):
    cur = cl[n-i-2]

    if cur in stones and stones[cur] != n-i-1:
        ans[n-i-2] = ans[n-i-1] + ans[stones[cur]]
        ans[n-i-2] %= mod
    else:
        ans[n-i-2] = ans[n-i-1] % mod
    stones[cur] = n-i-2

print(ans[0])


Measured memory_bytes: 36608
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int N = 200000 + 5;

int main(){
	ll n,m;
	cin >> n >> m;
	vector<ll> a(n);
	vector<ll> s(N,0);
	vector<ll> sum(n+1);
	for(ll i = 0; i < n; i++){
		cin >> a[i];
		s[a[i]]++;
	}
	sort(a.begin(),a.end());
	//记录比i大的值的个数 
	for(ll i = N; i > 0; i--)
		s[i-1] += s[i];
	sum[n] = 0;
	//求从大到小依次累加和 
	for(int i = n - 1; i >= 0; i--){
		sum[i] = a[i] + sum[i+1];
	}
	ll r = N,l = 0;
	//二分查找(总共大的个数~m的值) 
	while(r - l > 1){
		ll mid = (l + r) / 2;
		ll cnt = 0;
		for(ll i = 0; i < n; i++){
			cnt += s[max(mid-a[i],0ll)];
		}
		if(cnt >= m)
			l = mid;
		else
			r = mid;
	}
	ll h = 0;
	for(ll i = 0; i < n; i++){		
		ll cnt1 = s[max(r - a[i],0ll)];
		h = h + cnt1 * a[i] + sum[n-cnt1];		
		m -= cnt1;		
	}
	
	h += m * l;
	cout << h << endl;
	return 0;
}
 

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
int main() {
    ll n;
    ll ans = 0;
    cin >> n;
    vector<pair<ll, ll>>p(n);
    rep(i, n) {
        cin >> p[i].second >> p[i].first;
    }
    sort(p.begin(), p.end());
    ll t = 0;
    string a = "Yes";
    rep(i,n) {
        //cout << t << ',' << p[i].first << ',' << p[i].second << endl;
        t += p[i].second;
        if (t <= p[i].first) {
        }else {
            a = "No";
            //cout << p[i].second;
            break;
        }
    }
    cout << a << endl;
    return 0;
}



Measured memory_bytes: 6400
n, q = map(int, input().split())
S = input()
cum = [0 for _ in range(n)]
for i in range(1, n):
    if S[i-1:i+1] == 'AC':
        cum[i] += cum[i-1] + 1
    else:
        cum[i] = cum[i-1]
for _ in range(q):
    l, r = map(int, input().split())
    print(cum[r-1] - cum[l-1])

Measured memory_bytes: 11552
x,y=map(int,input().split())
mod = 10**9+7
flflag=True

if (2*x-y)%3==0:
  a=(2*x-y)//3
else:
  flflag=False
if (2*y-x)%3==0:
  b=(2*y-x)//3
else:
  flflag=False

def kaijou(n):
  ans = 1
  for i in range(1,n+1):
    ans*=i%mod
    ans%=mod  
  return ans
if flflag:
  N=a+b
  R=min(a,b)
ans=0
if flflag==True and a>=0 and b>=0:
  ans=kaijou(N)
  ans1= (kaijou(N-R)*kaijou(R))%mod
  print((ans*pow(ans1,mod-2,mod))%mod)
else:
  print(0)

Measured memory_bytes: 9220
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

/*

ゲーム Grundy数
mex (minimum extended value)


石の個数がiであるときのGrundy数g[i]は

g[0] = 0
g[i] = mex(a in as && i - a >= 0) (g[i - a])


求めるものは g[k]

*/

void main(){
	int n = read.to!int;
	int k = read.to!int;
	
	int[] as = readln.chomp.split.map!(to!int).array;
	
	int[] g;
	foreach(i; 0 .. k + 1){
		int[] us = as.filter!(a => i - a >= 0).map!(a => g[i - a]).array;
		us.sort();
		g ~= mex(us);
	}
	
	if(g[k] > 0) "First".writeln;
	else "Second".writeln;
}

int mex(int[] xs){ // xsは小さい順にソートされている前提
	int m = 0;
	foreach(x; xs){
		if(x < m) continue;
		else if(x == m) m += 1;
		else return m;
	}
	return m;
}



Measured memory_bytes: 3452
#include <bits/stdc++.h>
using namespace std;
set<int>st;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    for(int i=a;i<=min(a+c-1,b);i++)
        st.insert(i);
    for(int i=max(a,b-c+1);i<=b;i++)
        st.insert(i);
    for(int i:st)cout<<i<<'\n';
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long a = sc.nextLong();
        long b = sc.nextLong();
        long es[] = new long[n];
        for (int i = 0; i < n; i++) {
            es[i] = sc.nextLong();
        }
        Arrays.sort(es);
        long ans;
        long l = 0, r = 1000000000L;
        while (r - l > 1) {
            ans = (r - l) / 2 + l;
            if (check(es, ans, a, b)) {
                r = ans;
            }
            else {
                l = ans;
            }
        }
        System.out.println(r);
    }

    static boolean check(long[] es, long t, long a, long b) {
        int idx = 0;
        long add = a - b;
        long base = b * t;
        while(idx < es.length && es[idx] <= base) idx++;
        long count = 0;
        for (; idx < es.length; idx++) {
            count += (es[idx] - base + add - 1) / add;
        }
        return count <= t;
    }
}


Measured memory_bytes: 51024
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
#define f(i,x,n) for(int i=x;i<n;++i)
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int mod;
int h,w;
int mx=-1;
vector<int> adj[1000];
bool vis[20][20];
int level[20][20];
string s[20];
int zrr[200005];
void fact(){
	zrr[0]=1;
	for(int i=1;i<200005;++i){
		zrr[i]=i*zrr[i-1];
		zrr[i]%=mod;
	}
}
int mpp(int x){
	int r=1;
	int c=2;
	while(x!=0){
		if(x&1){
			r*=c;
			r%=mod;
		}
		x/=2;
		c*=c;
		c%=mod;
	}
	return r;
}
int modexp(int x){
	int y=mod-2;
	int res=1;
	while(y>0){
		if(y&1){
			res*=x;
			res%=mod;
		}
		x*=x;
		x%=mod;
		y/=2;
	}
	return res;
}
int nck(int n,int k){
	if(n<k)
	return 0;
	int r=1;
	for(int i=n;i>n-k;--i){
		r*=i;
		r%=mod;
	}
	r=(r*modexp(zrr[k]))%mod;
	return r;
}
void solve(){	
	fact();
	int n,a,b; cin>>n>>a>>b;
	int pp=mpp(n);
	--pp;pp+=mod;pp%=mod;
	pp-=nck(n,a);
	pp+=mod;pp%=mod;
	pp-=nck(n,b);
	pp+=mod;pp%=mod;
	cout<<pp<<"\n";
}

// -----------------------------------------------------------------------


int32_t main()
{
	mod=1e9+7;
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}


Measured memory_bytes: 1792
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    d = LI()
    ans = 0
    for i in range(n):
        for j in range(i):
            ans += d[i]*d[j]
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


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

int main() {
  int N, V[20], C[20];
  cin >> N;
  for (int i = 0; i < N; i++) cin >> V[i];
  for (int i = 0; i < N; i++) cin >> C[i];
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (V[i] > C[i]) sum += V[i] - C[i];
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
// package app;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;
import java.util.StringJoiner;
import java.util.stream.Stream;

public class Main {

    public static void main(final String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
        }

        long result = 1;
        long bad = 1;
        for (int i = 0; i < N; i++) {
            result *= 3;

            if(a[i] % 2 == 0) bad *= 2;
        }

        System.out.println(result - bad);
    }

}

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

#define ll long long int

int main()
{

    int n;
    cin>>n;
    if(n%1000==0) cout<<'0'<<endl;
    else{
        cout<<(n/1000+1)*1000-n;
    }
    return 0;
}



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

//const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    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 { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/


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

    int x = 0;
    int ans = 0;

    for (int i = 0; i < n; i++) {
        if (s[i] == 'I')
            x++;
        else if (s[i] == 'D')
            x--;

        ans = max(ans, x);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    
    int[] A = new int[N];

    for (int i = 0; i < N; i++) {
      int a = sc.nextInt();
      A[a - 1] = i + 1;
    }

    sc.close();
  
    for (int i = 0; i < N; i++) {
      System.out.print(A[i]);
      if (i != N - 1) {
        System.out.print(" ");
      }
    }

    System.out.println("");
    
  }

}

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

#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

ll gcd(ll a,ll b){
	if(b == 0)return a;
	return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	if(a == 0)return b;
	if(b == 0)return a;
	return 1ll*a/gcd(a,b)*b;
}
ll isnp[10010],n;
vector<int> V,tv;
set<int> S;
ll ans[505][505];
int main() {
	read(n);
	int sub = 0;
	if(n%2 == 1){
		n+=1;
		sub+=1;
	}
	int m = n;
	if(m%2 == 0)m+=1;
	for(int i=1;i<=m/2;i++){
		tv.push_back(i);
		tv.push_back(m-i);
	}
	for(int i=2;i<10010;i++){
		if(isnp[i])continue;
		if(i>=m && V.size()<(n+1)/2)V.push_back(i);
		for(int j = i+i;j<10010;j+=i)isnp[j] = 1;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if((i+j)%2 ==0){
				ans[i][j] = tv[j-1]*V[(i-1)/2];
				assert(S.count(ans[i][j]) == 0);
				S.insert(ans[i][j]);
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if((i+j)%2 ==1){
				ll cl = lcm(lcm(ans[i-1][j],ans[i+1][j]),lcm(ans[i][j-1],ans[i][j+1]));
				ans[i][j] = cl+1;
				while(S.count(ans[i][j]))ans[i][j]+=cl;
				assert(ans[i][j]<1e15);
				S.insert(ans[i][j]);
			}
		}
	}
	n-=sub;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cout<<ans[i][j]<<"\t";
		}
		cout<<endl;
	}
	return 0;
}


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

int main(){
 int a,b,c,e;
  cin>>a>>b>>c;
vector<double>d(a);
  double ans;
  ans=1000000;
  for(int i=0;i<a;i++){
    cin>>d[i];
 d[i]=b-d[i]*0.006;
    if(ans>abs(c-d[i])){
   e=i+1;
      ans=min(ans,abs(c-d[i]));
  }
       }
  cout<<e<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m;
int num[100005];
int yu[100005];
int temp;
int ans;
int main()
{
    scanf("%d %d",&n,&m);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&temp);
        num[temp]++;
        yu[temp%m]++;
    }
    if(yu[0]>=2)
    {
        int minn=yu[0]/2;
        yu[0]-=minn*2;
        ans+=minn;
    }
    for(int i=1;i<m;i++)
    {
        if(yu[i]>0 && yu[m-i]>0)
        {
            if(i!=m-i)
            {int minn=min(yu[i],yu[m-i]);
            yu[i]-=minn;
            yu[m-i]-=minn;
            ans+=minn;}
            else
            {
                int minn=yu[i]/2;
                yu[i]-=minn*2;
                ans+=minn;
            }
        }
    }
    for(int i=1;i<=100000;i++)
    {
        if(num[i]>=2 && yu[i%m]>=2)
        {
            int minn=min(num[i]/2,yu[i%m]/2);
            yu[i%m]-=2*minn;
            ans+=minn;
            //cout<<i<<endl;
        }
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 1024
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int convert(char c) {
	return c - 'a';
}

int main() {
	string s, t; cin >> s >> t;

	vector<vector<int>> tb(26, vector<int>());

	for (int i = 0; i < s.size(); i++) {
		tb[convert(s[i])].push_back(i);
	}

	int pos = 0;
	int index = -1;

	LL cnt = 0;
	while (pos < t.size()) {
		

		int key = convert(t[pos]);

		if (tb[key].size() == 0) {
			cout << "-1" << endl;
			return 0;
		}

		auto it = upper_bound(tb[key].begin(), tb[key].end(), index);

		if (it != tb[key].end()) {
			pos++;
			index = *it;
		}
		else {
			index = -1;
			cnt++;
		}
	}

	cout << cnt * (LL)s.size() + (LL)(index+1) << endl;

	return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define pb push_back
#define log(x,b) (log(b)/log(x))
#define rep(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int mod=1e9+7;
string s[55];
int32_t main()
{	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	string ans = "";
	for (char c = 'a'; c <= 'z'; c++) {
		int mi = mod;
		int count = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < s[i].size(); j++) {
				if (s[i][j] == c) {
					count++;
				}
			}
			mi = min(mi, count);
			count = 0;
		}
		for (int k = 0; k < mi; k++) {
			ans += c;
		}
	}
	cout << ans << endl;
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  if(S.at(0)=='A' && S.at(1)=='A' && S.at(2)=='A'){
    cout << "No" << endl;
  }
  else if (S.at(0)=='B' && S.at(1)=='B' && S.at(2)=='B'){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
  
  
}

  
  

  
  // int型の2次元配列(3×4要素の)の宣言
  //vector<vector<int>> data(3, vector<int>(4));

  // 入力 (2重ループを用いる)
  //for (int i = 0; i < 3; i++) {
    //for (int j = 0; j < 4; j++) {
      //cin >> data.at(i).at(j);
    //}
  //}


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

using namespace std;

typedef long long ll;

const int N = 4e2 + 10;
const ll oo = 1ll << 60;

ll dp[N][N];
ll a[N];

ll solve(int l, int r)
{
	if(l > r)
		return oo;

	if(l == r)
		return 0;

	if(l + 1 == r)
		return a[l] + a[r];

	ll &ans = dp[l][r];

	if(ans != -1)
		return ans;

	ans = oo;
	
	ll s = 0;
	for(int i = l; i <= r; i++)
		s += a[i];

	for(int i = l; i <= r; i++)
	{
		ll cur = solve(l, i) + solve(i + 1, r) + s;

		ans = min(ans, cur);
	}	

	return ans;
}

int main()
{

	memset(dp, -1, sizeof(dp));

	int n;
	cin >> n;

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

	cout << solve(0, n - 1) << endl;

	return 0;
}

Measured memory_bytes: 1536
def main():
    h, w, d = map(int, input().split())
    sq = []
    for i in range(h):
        sq.append(list(map(int, input().split())))

    p = [{} for i in range(d)]
    for i in range(h):
        for j in range(w):
            a = sq[i][j]
            p[a%d][a] = (i, j)

    sp = [[0 for j in range(len(p[i]))] for i in range(d)]
    for i in range(1, d+1):
        b, idx = i + d, 1
        i %= d

        while b <= h * w:
            x1, y1 = p[i][b][0], p[i][b][1]
            x2, y2 = p[i][b-d][0], p[i][b-d][1]
            sp[i][idx] = sp[i][idx-1] + abs(x1-x2) + abs(y1-y2)
            idx += 1
            b += d

    q = int(input())
    for i in range(q):
        l, r = map(int, input().split())
        res = sp[r%d][(r+d-1)//d-1] - sp[l%d][(l+d-1)//d-1]
        print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 51060
N, A, B, C, D = map(int, input().split())
S = input()

flg = True
if A < B and C > D:
    flg = False
    for i in range(B-2, D-1):
        if S[i:i+3] == "...":
            flg = True
            break
if A > B and C < D:
    flg = False
    for i in range(A-2, C-1):
        if S[i:i+3] == "...":
            flg = True
            break
for i in range(A-1, C-2):
    if S[i:i+2] == "##":
        flg = False
        break
for i in range(B-1, D-2):
    if S[i:i+2] == "##":
        flg = False
        break

if flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3640
#include <stdio.h>

int main(void){
  
  long int a, b, n;
  
  scanf("%ld %ld", &a, &b);
  
  n = 1;
  while(a * n % b != 0){
    n++;
  }
  
  printf("%ld\n", a * n);
  
  return 0;
}

Measured memory_bytes: 128
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FS r = new FS();
		int N = r.nextInt();
		int k =1;
		while(true) {
			if(N<=k*(k+1)/2) break;
			k++;
		}
		for(int i=1; i<=k; i++) {
			if(k*(k+1)/2-N==i) continue;
			System.out.println(i);
		}
	}
	
	public static void solver() {
		// write logic
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}

Measured memory_bytes: 10428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {
    ll n, p;
    cin >> n >> p;
    auto vp = prime_factorize(p);
    ll ans = 1;
    for (auto pa : vp) {
        if (pa.second >= n) {
            ll e = pa.second / n;
            rep(i, 0, e) ans *= pa.first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import Text.Printf

trunc :: [[String]] -> [[String]]
trunc [] = []
trunc (x@(a:op:b:_):s)
  | op == "?" = []
  | otherwise = x:(trunc s)

ans :: [String] -> String
ans (a:op:b:_)
  | op == "+" = show $ (read a) + (read b)
  | op == "-" = show $ (read a) - (read b)
  | op == "*" = show $ (read a) * (read b)
  | op == "/" = show $ (read a) `div` (read b)
  | op == "?" = []

main = do
  c <- getContents
  let i = map words $ lines c
      j = trunc i
      a = map ans j
  mapM_ (putStrLn) a

Measured memory_bytes: 4040
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x=max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<P>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,sz(v))i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(sz(v))o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
template <class T> inline ll suma(const v(T)& a) 
{ ll res(0); for(auto&& x:a) res += x; return res;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
#define dame {puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------
template <class T>
map< T, int > prime_factor(T n) {
    map< T, int > ret;
    for(T i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

void Main(){
  int n;
  ll x;
  cin>>n>>x;
  ll pre = 0;
  ll ans = 0;
  rep(i,n){
    ll t;
    cin>>t;
    ans += (t-pre<=x? t-pre:x);
    pre = t;
  }
  cout<<ans+x<<endl;
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

Measured memory_bytes: 256
import java.util.*
//import kotlin.math.*
 
private fun readString() = readLine()!! // string line
private fun readInt() = readString().toInt() // single int
private fun readLong() = readString().toLong()
private fun readStrings() = readString().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map { it.toLong() } // list of ints
 
val INF = 1000000000
 
fun main(args: Array<String>)
{
    var a = readInt()
	print(a*a*a)
}


Measured memory_bytes: 29864
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod = 998244353;
ll fact[210200];
ll invfact[210200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll powMod(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return powMod(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}

int dp[3100][3100];

int main(){
    string s, t;
    cin >> s;
    cin >> t;
    for(int i = 0; i < 3100; i++){
        for(int j = 0; j < 3100; j++){
            dp[i][j] = 0;
        }
    }

    for(int i = 0; i <= s.length(); i++){
        for(int j = 0; j <= t.length(); j++){
            dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
            dp[i][j+1] = max(dp[i][j+1], dp[i][j]);
            if(i == s.length() || j == t.length()) {
                continue;
            }
            if(s[i] == t[j]){
//                cout << i << " " << j << " " << dp[i][j] << endl;
                dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1);
            }
            else{
                dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]);
            }
        }
    }
//    for(int i = 0; i <= s.length(); i++){
//        for(int j = 0; j <= t.length(); j++){
//            cout << dp[i][j] << " ";
//        }
//        cout << endl;
//    }

    int i = s.length(), j = t.length();
    string res = "";
    while(i > 0 && j > 0){
        if(dp[i][j] == dp[i-1][j-1] + 1 && dp[i][j] == dp[i-1][j] + 1 && dp[i][j] == dp[i][j-1] + 1){
            res += s[i-1];
            i--;
            j--;
        }
        else if(dp[i][j] == dp[i-1][j]){
            i--;
        }
        else{
            j--;
        }
    }

    reverse(res.begin(), res.end());
    cout << res << endl;

    return 0;
}


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

int main()
{
    string s;
    cin>>s;
    int a=s[0]-'0',b=s[1]-'0',c=s[2]-'0',d=s[3]-'0';
    if(a+b+c+d==7) cout<<a<<'+'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
    else if(a+b+c-d==7) cout<<a<<'+'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
    else if(a+b-c+d==7) cout<<a<<'+'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
    else if(a+b-c-d==7) cout<<a<<'+'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;
    else if(a-b+c+d==7) cout<<a<<'-'<<b<<'+'<<c<<'+'<<d<<"=7"<<endl;
    else if(a-b+c-d==7) cout<<a<<'-'<<b<<'+'<<c<<'-'<<d<<"=7"<<endl;
    else if(a-b-c+d==7) cout<<a<<'-'<<b<<'-'<<c<<'+'<<d<<"=7"<<endl;
    else if(a-b-c-d==7) cout<<a<<'-'<<b<<'-'<<c<<'-'<<d<<"=7"<<endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! p {
    ($($x:expr),*) => {
        $(println!("{:?}", $x);)*
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
         #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        a:i32, b:i32, c:i32
    }
    let ans = c - (a - b);
    p!(if ans > 0 { ans } else { 0 });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	ll x;
  cin>>x;
  ll ans=0;
  ll a=360;
  while(a!=0){
    ans+=a/x;
    a%=x;
    if(a)a+=360;
  }
  cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3644
import scala.io.StdIn

object Main extends App {

  val n  = StdIn.readLine().toInt
  val s  = StdIn.readLine()
  val k  = StdIn.readLine().toInt    

  def solve(s: String, k: Int): String = {
    val f =  s(k -1)
    s.map(v => if(f != v) {"*"} else {v}).mkString

  }

  println(solve(s, k))
}
  




Measured memory_bytes: 25528
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

H,N = II()
A = III()

if H-sum(A)<=0:
    print('Yes')
else:
    print('No')

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

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

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		long n = stdIn.nextLong();
		long a = stdIn.nextLong();
		long b = stdIn.nextLong();
		
		long c = a + b;
		
		long cnt = n / c;
		
		if(n - cnt * c <= a) {
			System.out.println(cnt * a + (n - cnt * c));
		}else {
			System.out.println(cnt * a + a);
		}
		
		
	}

}


Measured memory_bytes: 24916
n, m = gets.split.map(&:to_i)

as = m.times.with_object(Hash.new(0)) do |i, h|
  i = gets.to_i
  h[i] = false
end

ans = Array.new(n + 1, 0)
mod = 10 ** 9 + 7

ans[0] = 1
ans[1] = 1 if as[1]

2.upto(n) do |i|
  ans[i] += ans[i - 1] if as[i - 1]
  ans[i] += ans[i - 2] if as[i - 2]
  ans[i] %= mod
end

puts ans[n]


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

int main()
{
	static char T[200001];
	scanf("%s", T);

	size_t len = strlen(T);
	for (size_t i = 0; i < len; i++) {
		if (T[i] == '?') {
			T[i] = 'D';
		}
	}
	printf("%s\n", T);

	return 0;
}


Measured memory_bytes: 1800
/**
 *    created by : PawPaw       
**/

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

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define N 1000001
#define PB push_back
#define MP make_pair


int solve(){
  int n;
  string s;
  string e;
  F(i, 0, 25) e.PB(char('A'+i));
  cin >> n;
  cin >> s;
  F(i, 0, (int)s.size()-1) cout << e[((int)s[i]-'A'+n) % 26];
  cout << '\n';
  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

  fun();
  
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int i, j;
    int r, c, v, sum;
    int sheet[100][100];
    int s[100] = {0};

    scanf("%d %d", &r, &c);
    for(i = 0; i < r; i++){
        for(j = 0; j < c; j++){
            scanf("%d", &v);
            sheet[i][j] = v;
        }
    }
    for(i = 0; i < r; i++){
        sum = 0;
        for(j = 0; j < c; j++){
            if(j) printf(" ");
            printf("%d", sheet[i][j]);
            sum += sheet[i][j];
            s[j] += sheet[i][j];
            if(j == c - 1)
                printf(" %d\n", sum);
        }
    }
    sum = 0;
    for(i = 0; i < c; i++){
        if(i) printf(" ");
        printf("%d", s[i]);
        sum += s[i];
        if(i == c - 1)
            printf(" %d\n", sum);
    }
    return 0;
}

Measured memory_bytes: 1856