akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

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

		int[] a = nextInts();

		int ans =a[0];
		if(a[0]>a[1]){
			ans--;
		}


		System.out.println(ans);

	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21332
#include <iostream>
#include <algorithm>

using namespace std;

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

    int ans =0;
    sort(A,A+n);
    for(int i = 0;i<n;i++){
        for(int j = i+1;j<n;j<j++){
            for(int k = j+1;k<n;k++){
                if(A[i]+A[j] > A[k]){ans+=1;}
            }
    
        }   
    }
    cout << ans << endl;;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define ll long long
#define mset(s, _) memset(s, _, sizeof s)
#define ALL(a) (a).begin(), (a).end()
using namespace std;

int main(void) {
  int n;
  cin >> n;
  map<string, int> M;
  string s;
  rep(i, 1, n) {
    cin >> s;
    M[s]++;
  }

  cout << "AC x " << M["AC"] << endl;
  cout << "WA x " << M["WA"] << endl;
  cout << "TLE x " << M["TLE"] << endl;
  cout << "RE x " << M["RE"] << endl;
  return 0;
}


Measured memory_bytes: 3628
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(new InputStreamReader(System.in));
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		if((a*b>c*d)||(a*b==c*d)){
			System.out.println(a*b);
		}else {
			System.out.println(c*d);
		}

	}
}


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

int main(){
  char c;
  bool a,i,u,e,o;

  cin >> c;

  a = c == 'a';
  i = c == 'i';
  u = c == 'u';
  e = c == 'e';
  o = c == 'o';

  if ( a || i || u || e || o ){
      cout << "vowel" << endl;
  } else {
      cout << "consonant" << endl;
  }
}

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

int parent(int);
int left(int);
int right(int);
void maxHeapify(int*,int);
void buildMaxHeap(int*);

int h;

int main(){
  int l,r,*A;
  int i;

  scanf("%d",&h);
  A = (int *)malloc(sizeof(int)*(h+1));
  for(i=1;i<=h;i++){
    scanf("%d",&A[i]);
  }

  buildMaxHeap(A);
  
  for(i=1;i<=h;i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}

int parent(int i){
  return i/2;
}

int left(int i){
  return i*2;
}

int right(int i){
  return i*2+1;
}

void maxHeapify(int* A,int i){
  
  int l,r,largest,tmp;
  
  l = left(i);
  r = right(i);

  if(l<=h && A[l]>A[i]) largest = l;
  else largest = i;

  if(r<=h && A[r]>A[largest]) largest = r;
  
  if(largest != i){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(A,largest);
  }
  return;
}

void buildMaxHeap(int* A){
  int i;
  
  for(i=h/2;i>0;i--) maxHeapify(A,i);
  return;
}

Measured memory_bytes: 2556
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	vector<int> a( N );
	for( auto& v: a ) { cin >> v; }

	int ans = 0;
	int x = a[0];
	for( int i = 1; i < N; ++i ) {
		if( a[i] == x ) {
			x = 0;
			ans += 1;
		}
		else {
			x = a[i];
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i = 0; i < n; i++)
#define rep2(i,start,end) for(ll i = start; i < end; i++)
#define dwn(i,n) for(int i = n; i >= 0; i--)
#define dwn2(i,start,end) for(ll i = start; i >= end; i--)
#define pll pair<ll,ll>
#define mk(x,y) make_pair(x,y)
#define pdl pair<double, ll>
const ll N = 4e5 + 200;
const ll INF = 9999999999;
const ll mod = 1e9 + 7;


int main(){
	string s;
	ll n;
	cin>>n;
	cin>>s;
	int sum = 0;
	rep(i,n){
		if(i+2< n){
			if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
				sum++;
			}
		}
	}
	cout<<sum<<endl;



	return 0;
}





Measured memory_bytes: 256
#include<iostream>
#define MAXN 200500

using namespace std;

int a[MAXN];
long long b[MAXN];
const long long m = 1e9+7;

int main () {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    b[0] = a[n-1];
    for (int i = 1; i < n-1; ++i) {
        b[i] = b[i-1] + a[n-1-i];
        b[i] %= m;
    }
    int sum = 0;
    for (int i = 0; i < n-1; ++i) {
        sum += (int)((a[i]*b[n-2-i] % m));
        sum %= m;
    }
    cout << sum;
    return 0;
}


Measured memory_bytes: 5964
N,W = map(int,input().split())
wv_list = [tuple(map(int,input().split())) for _ in range(N)]

memo = [0  for _ in range(W+1)]

for weight,value in wv_list:
    for w in range(W+1)[::-1]:
        if w  >= weight:
            memo[w] = max(memo[w], memo[w-weight]+value)
            
print(memo[W])

Measured memory_bytes: 44912
import java.util.*;
import java.io.*;
public class Main{
   
public static void main (String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int k=sc.nextInt();
    int s=sc.nextInt();
    if(k==0)
    {
        if(s==1)
        {
            for(int i=0;i<n;i++)
            System.out.print((s+1)+" ");
            System.out.println();
        }
        if(s!=1)
        {
             for(int i=0;i<n;i++)
            System.out.print((s-1)+" ");
            System.out.println();
        }
    }
    if(k==n)
    {
            for(int i=0;i<n;i++)
            System.out.print(s+" ");
            System.out.println();
    }
    if(k>0&&k<n)
    {
        for(int i=0;i<k;i++)
        System.out.print(s+" ");
        for(int i=k;i<n;i++)
        System.out.print((s!=1000000000?s+1:s-1)+" ");
        System.out.println();
    }
}
}

Measured memory_bytes: 44964
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

	public static void main(String[] args) { //WOOOOOOO AtCoder is HELPING!!!!!!!!!!
		//Arraylist cheese for the win
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		long ans = 0;
		ArrayList<Long> deductions = new ArrayList<Long>();
		for (int i = 0; i < N; i++) {
			long x = input.nextLong();
			ans+=x;
			while (x>0) {
				long sub = x-x/2;
				deductions.add(sub);
				x/=2;
			}
		}
		Collections.sort(deductions);
		int index = deductions.size()-1;
		int cnt = 0;
		while (cnt < M) {
			ans-=deductions.get(index);
			cnt++;
			index--;
			if (index==-1) break;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 168020
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

int main() {
  vector<string> s(3);
  rep(i, 3) cin >> s[i];

  rep(i, 3) cout << s[i][0];
  cout << endl;


  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	int a=read(),b=read();
	if ((a>=1) && (a<=9) && (b>=1) && (b<=9)) printf("%d",a*b);
	else puts("-1");
	return 0;
}


Measured memory_bytes: 256
N = int(input())
AC, WA, TLE, RE = 0, 0, 0, 0
for _ in range(N):
    s = input()
    if s == "AC":
        AC += 1
    elif s == "WA":
        WA += 1
    elif s == "TLE":
        TLE += 1
    else:
        RE += 1
print(f"AC x {AC}\nWA x {WA}\nTLE x {TLE}\nRE x {RE}")
    

Measured memory_bytes: 9200
function Main(input){
  var S = input.trim();
  if(S === "Sunny"){
    console.log("Cloudy");
  }else if(S === "Cloudy"){
    console.log("Rainy");
  }else if(S === "Rainy"){
    console.log("Sunny");
  }
  
  


}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));




Measured memory_bytes: 21064
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
using ll = long long;

using namespace std;




int main()
{/*六日目*/
//少数も使いたい割り算はしない方がいい
// 数値の大きさ
//for文で0代入する場所はforの一文下
//オーバーフローする一手手前を分解して作る・ 割り算で減らしていく
//for文いつも間違える/ i<nなら最後はa[n-1]

//関数使ってみるよ(五日目)
	int n, k; cin >> n >> k;
	vector<int> yy(n);
	vector<int>mmax(k);
	for (int i = 0;i < n;i++) {
		cin >> yy[i];
	}
	sort(yy.begin(), yy.end());
	ll sum = 0;
	for (int i = 0;i < n - k;i++)
		sum += yy[i];
	cout << sum;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fi("input.in");

const ll MOD = 1000000007;

ll n, m;
ll sx, sy;
ll x[100005], y[100005];
signed main()
{
    cin >> n >> m;
    for (ll i = 1; i <= n; i++)
        cin >> x[i];
    for (ll i = 1; i <= m; i++)
        cin >> y[i];

    for (ll i = 1; i <= n; i++)
        sx = (sx + 1LL * (i - 1) * x[i] % MOD - 1LL * (n - i) * x[i] % MOD + MOD) % MOD;
    for (ll i = 1; i <= m; i++)
        sy = (sy + 1LL * (i - 1) * y[i] % MOD - 1LL * (m - i) * y[i] % MOD + MOD) % MOD;

    cout << sx * sy % MOD;
    return 0;
}


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

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

int main(){
	int n;	cin>>n;
	vector<int> a(n),b(n),c(n);
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cin>>b[i];
	for(int i=0;i<n;i++)cin>>c[i];
	sort(ALL(a));	sort(ALL(b));	sort(ALL(c));


	long long ans=0;
	for(int i=0;i<n;i++){
		long long tmp=1;
		int B=b[i];
		int OK=-1,NG=n;
		while(NG-OK>1){
			int mid=(NG+OK)/2;
			if(B>a[mid])OK=mid;
			else NG=mid;
		}
		tmp*=(OK+1);
		//cout<<(OK+1)<<endl;

		NG=-1;	OK=n;
		while(OK-NG>1){
			int mid=(OK+NG)/2;
			if(B<c[mid])OK=mid;
			else NG=mid;
		}
		tmp*=(n-OK);
		//cout<<(n-OK)<<endl;
		//cout<<endl;

		ans+=tmp;
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1408
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int x[100000],y[100000],x_mod_k[100000],x_div_k[100000];
char s[100000][2];
int cnt[100000];
int n,k;

void add(int x,int t){//(x+??)/k%2=t
	if((x_div_k[x]&1)==0){
		if(t==0){//たさない
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
		else{//たす
			cnt[k-x_mod_k[x]]++;
		}
	}
	else{
		if(t==0){
			cnt[k-x_mod_k[x]]++;
		}
		else{
			cnt[0]++;
			cnt[k-x_mod_k[x]]--;
		}
	}
}
signed main(){
	scanf("%d%d",&n,&k);
	rep(i,n){
		scanf("%d%d%s",&x[i],&y[i],s[i]);
		x_mod_k[i]=y[i]%k;
		x_div_k[i]=y[i]/k;
	}
	int Max=0;
	rep(i,k){
		memset(cnt,0,sizeof(cnt));
		rep(j,n){
			if(s[j][0]=='B'){
				if(((x[j]+i)/k)%2==0){//(y[j]+t)/K%2=0
					add(j,0);
				}
				else{
					add(j,1);
				}
			}
			else{
				if(((x[j]+i)/k)%2==0){//(y[j]+t)/K%2=1
					add(j,1);
				}
				else{
					add(j,0);
				}
			}
		}
		rep(j,k){
			if(j)cnt[j]+=cnt[j-1];
			Max=max({Max,cnt[j],n-cnt[j]});
		}
	}
	cout<<Max<<endl;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <map>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n) + 1; i++)
#define all(vecto) vecto.begin(), vecto.end()
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
typedef long long ll;

void ans(bool qus)
{
    if (qus == true)
        std::cout << "Yes" << std::endl;
    else
        std::cout << "No" << std::endl;
}

void Ans(bool qust)
{
    if (qust == true)
        std::cout << "YES" << std::endl;
    else
        std::cout << "NO" << std::endl;
}

using namespace std;

/////////////////////////////////////////

int main(){
    string s;
    cin>>s;
    int count = 0;
    rep(i,3){
        if(s.at(i)=='1'){
            count++;
        }
    }
    cout << count << endl;
}

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

int main() {
  string s,t;
  int ans = 0;
  cin >> s >> t;
  int l = s.size();

  for (int i = 0; i < l; i++) {
    if (s.at(i) != t.at(i)) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3912
#include <atcoder/lazysegtree>
#include <atcoder/modint>
#include <cstdio>

using namespace std;
using namespace atcoder;

using mint = modint998244353;

struct S {
    mint a;
    int size;
};

struct F {
    mint a, b;
};

S op(S l, S r) { return S{l.a + r.a, l.size + r.size}; }

S e() { return S{0, 0}; }

S mapping(F l, S r) { return S{r.a * l.a + r.size * l.b, r.size}; }
F composition(F l, F r) { return F{r.a * l.a, r.b * l.a + l.b}; }

F id() { return F{1, 0}; }

int main() {
    int n, q;
    scanf("%d %d", &n, &q);

    vector<S> a(n);
    for (int i = 0; i < n; i++) {
        int x;
        scanf("%d", &x);
        a[i] = S{x, 1};
    }

    lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);

    for (int i = 0; i < q; i++) {
        int t;
        scanf("%d", &t);
        if (t == 0) {
            int l, r;
            int c, d;
            scanf("%d %d %d %d", &l, &r, &c, &d);
            seg.apply(l, r, F{c, d});
        } else {
            int l, r;
            scanf("%d %d", &l, &r);
            printf("%d\n", seg.prod(l, r));
        }
    }
}


Measured memory_bytes: 19284
#include<iostream>
using namespace std;
 
int main(void) {
	int n, m, a[100], total = 0,c = 0;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		total += a[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] * 4 * m >= total) c++;
	}
	if (c >= m)cout << "Yes" << endl;
	else cout << "No" << endl;
	 return 0;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
using namespace std;
int main(){
//	freopen("input.txt","r",stdin);
	ios::sync_with_stdio(false);
	cin.tie(0);
	LL n,a,b;
	cin>>n>>a>>b;
	if(n==1){
		if(a==b) cout<<"1"<<endl;
		else cout<<"0"<<endl;
	}
	else{
		if(a>b) cout<<"0"<<endl;
		else cout<<(n-2)*(b-a)+1<<endl;
	}
	return 0;
}

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


int main(void){
	
	int size=0;
	int min=1000;
	int max=0;
	int sum=0;
	int i;
	int j=0;
	int *data;
	int *ans;
	
	data=malloc(sizeof(int)* 100);
	ans=malloc(sizeof(int)*20);

		
		scanf("%d",&size);
		
			while(1){
		min=1000;
		max=0;
		sum=0;
		
		for(i=0;i<size;i++){
			scanf("%d",&data[i]);
			
			if(data[i]<=min){
				min=data[i];
			}
			if(data[i]>=max){
				max=data[i];
			}
			
			sum=sum+data[i];
			
		}
		
		sum=sum-max;
		sum=sum-min;		
		ans[j]=sum/(size-2);
		j++;
				
		scanf("%d",&size);
		if(size==0){
		break;	
		}		
	}
	ans[j]=1001;
	
	for(i=0;ans[i]!=1001;i++){
		printf("%d\n",ans[i]);
	}
			
	
	free(data);
	free(ans);

	return 0;
}

Measured memory_bytes: 600
from math import ceil


def enough(x):
    total = 0
    for hi in h:
        total += max(0, ceil((hi - B * x) / (A - B)))
        if total > x:
            return False
    return True

N, A, B = map(int, input().split())
h = [int(input()) for _ in range(N)]
h.sort()

l, r = (h[0] // A), (h[-1] // B + 1)
while l + 1 < r:
    m = (l + r) // 2
    if enough(m):
        r = m
    else:
        l = m

print(l if enough(l) else r)


Measured memory_bytes: 7512
#include<cstdio>
#include<cstring>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
int n;
int a[MAXN];
int ans[MAXN],cnt;
bool solve(int tot){
	if(tot==0)
		return 1;
	for(int i=tot;i>=1;i--)
		if(a[i]==i){
			ans[++cnt]=i;
			for(int j=i;j<tot;j++)
				a[j]=a[j+1];
			return solve(tot-1);
		}
	return 0;
}
int main(){
	SF("%d",&n);
	for(int i=1;i<=n;i++)
		SF("%d",&a[i]);
	if(solve(n)){
		for(int i=n;i>=1;i--)
			PF("%d\n",ans[i]);	
	}
	else
		PF("-1");
}	

Measured memory_bytes: 128
/* Author: Jason L.(int3xccATgmailDOTcom), Mon Sep 18 00:50:49 CST 2017 */
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pll = pair<ll, ll>; using dd = long double;
//=========================================================================
namespace {
static bool constexpr dbg =
#ifdef INT3XCC_DEBUG
        1;
#else
        0;
#endif
#define Dprintf(fmt, ...) do{if(dbg) printf(fmt, ##__VA_ARGS__);}while(0)
#define REP0(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
//=========================================================================
ll constexpr N = -1;
ll q, h, s, d, n;
//=========================================================================
void init() {
    cin>>q>>h>>s>>d>>n;
}
void solve() {
    cout<<(n/2*min({d, 2*s, 4*h, 8*q}) + (n&1)*min({s, 2*h, 4*q}));
}}
//=========================================================================
int main() {
    if (!dbg) { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
    cout<<fixed<<setprecision(20); init(); solve(); return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int a,b,c,temp;
   scanf("%d %d %d",&a,&b,&c);
   
   if(a>b){
       temp=a;
       a=b;
       b=temp;
   }
   if(b>c){
       temp=b;
       b=c;
       c=temp;
   }
   if(a>b){
       temp=a;
       a=b;
       b=temp;
   }
   
   printf("%d %d %d\n",a,b,c);
  
  return 0;  
}



Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ULL;
typedef long long LL;
#define FOR(i, a, b) for(LL i=(LL)(a);i<(LL)(b);i++)
#define REP(i,x) for(LL i=0;i<(LL)(x);i++)

template <class T> class UnionFind
{
private:
    // 親の番号
    vector<T> par;    

public:
    // 初期化
    void init(T n)
    {
        for(T i=0; i<n; i++)
        {
            par.push_back(-1);
        }
    }

    // 根を求める
    T root(T x)
    {
        T lRet;
        // サイズ異常
        if(par.size() <= x)
        {
            return -1;
        }

        // 値が負のものが根なので、そのxを返す
        if(par.at(x) < 0)
        {
            lRet = x;
        }
        else
        {
            // 違う場合は経路圧縮して根を返す
            par.at(x) = root(par.at(x));
            lRet = par.at(x);
        }

        return lRet;
    }

    // 同じグループに属しているかを比較
    bool same(T x, T y)
    {
        bool lRet = root(x) == root(y);
        return lRet;
    }

    // 2つのグループを併合
    void unite(T x, T y)
    {
        // サイズ異常
        if(par.size() <= x || par.size() <= y)
        {
            return;
        }

        x = root(x);
        y = root(y);
        if(x == y)
        {
            // 既に同じグループなのがわかっているので何もしない
            return;
        }

        // https://drken1215.hatenablog.com/entry/2020/03/02/022900
        // 正の値なら所属する根、負の値ならその根に属する個数をparに入る
        if(par.at(x) > par.at(y)) swap(x, y);

        par.at(x) += par.at(y);
        par.at(y) = x;
    }

    T size(T x)
    {
        return -par[root(x)];
    }
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    // cout << fixed << setprecision(10);
    LL n, m, k;
    cin >> n >> m >> k;

    UnionFind<LL> uf;
    uf.init(n);
    vector<set<LL>> noCandidate(n, set<LL>());

    // 友人関係
    REP(i, m)
    {
        LL a, b;
        cin >> a >> b;
        noCandidate.at(a-1).insert(b-1);
        noCandidate.at(b-1).insert(a-1);
        uf.unite(a-1, b-1);
    }

    // ブロック関係
    REP(i, k)
    {
        LL c, d;
        cin >> c >> d;
        if(uf.same(c-1, d-1))
        {
            noCandidate.at(c-1).insert(d-1);
            noCandidate.at(d-1).insert(c-1);
        }
    }

    REP(i, n)
    {
        LL mem = uf.size(i)-1;
        mem -= noCandidate.at(i).size();
        cout << mem << " ";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 25204
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

int main()
{
	int a, b, c, d, cost=0;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	if(a>b){
		cost=cost+b;
	}else{
		cost=cost+a;
	}
	if(c>d){
		cost=cost+d;
	}else{
		cost=cost+c;
	}
	printf("%d\n", cost);
	return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pi 3.1415926536
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define N 1000000007
#define INF (1ll<<60) - 1
#define M 998244353
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define nrep(i,a,b) for(int i=a;i>=b;i--)
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll t,i,j,l,h,x,k,y,q,n;
    string s,ss;
    ll val=0;
	cin>>s;
	cin>>ss;
	rep(i,0,s.length()-1){
		if(s[i] != ss[i]) val++;
	}	
	cout<<val;
}

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

#define int				long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define FORE( i, m, n ) FOR( i, m , n + 1 )
#define REP( i, n )     FOR( i, 0, n )
#define REPE( i, n )	FOR( i, 0, n + 1 )
#define REPR( i, m )	for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )	FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define P				pair<string, int>
#define fi				first
#define se				second

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

const int INF = 1e9;
const int MOD = 1e9 + 7;
const int MAX_N = 100;

bool G[MAX_N][MAX_N];

signed main() {
	fill( G[0], G[MAX_N], false );
	int n; cin >> n;
	REP( i, n ) {
		int v, k; cin >> v >> k;
		v--;
		REP( j, k ) {
			int u; cin >> u;
			u--;
			G[v][u] = true;
		}
	}

	REP( i, n ) {
		REP( j, n ) {
			if( !j ) cout << G[i][j];
			else	cout << " " << G[i][j];
		}
		cout << endl;
	}
}


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

int main()
{
    int N, K;
    cin >> N >> K;
    int _;
    for (int i = 0; i < N; i++)
        cin >> _;
    if ((N - 1) % (K - 1) == 0)
        cout << (N - 1) / (K - 1) << endl;
    else
        cout << (N - 1) / (K - 1) + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	const int MAX = 10010;
	int katarogu[MAX] = { 0 };
	const int NOsosu = 1;
	int num[MAX] = { 0 };
	num[1] = NOsosu;
	for (int i = 3; i < MAX; i = i + 2){
		for (int j = 3; j*j <= i; j = j + 2){
			if (i%j == 0){ num[i] = NOsosu; break; }
		}
		katarogu[i - 1] = katarogu[i - 2];
		katarogu[i] = katarogu[i - 2];
		if (num[i] != NOsosu && num[i - 2] != NOsosu){ katarogu[i] = i; }
	}
	int a;
	while (cin >> a, a != 0){ cout << katarogu[a] - 2<<" "<<katarogu[a] << endl; }

	return 0;
}


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

int main(){
	int k;
	cin >> k;
	int a,b;
	cin >> a >> b;
	int cnt=0;
	for(int i=a;i<=b;i++){
		if(i%k==0) {
			cnt=1;
			cout << "OK\n";
			break;
		}
	}
	if(cnt==0) cout << "NG\n";
}

Measured memory_bytes: 3672
#ifdef __APPLE__
  #include "/Users/shizuku/Dropbox/dev/cpp/base_cmake_project_external/frankchen0130/bits/stdc++.h"
#else
  #include "bits/stdc++.h"
#endif
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }

constexpr auto MAX_LEN = 100;
constexpr auto ALPHA_LEN = 26;
int N;
char S[MAX_LEN + 1];
vector<unsigned int> left_side(ALPHA_LEN, 0);
vector<unsigned int> right_side(ALPHA_LEN, 0);

void _main() {
  cin >> N >> S;
  rep(i, 0, N) {
    auto index = S[i]-'a';
    right_side[index]++;
  }

  unsigned int ans = 0,  t_ans = 0;
  rep(i, 0, N) {
    auto index = S[i]-'a';
    if (right_side[index] > 1 && left_side[index] == 0) {
      t_ans++;
    } else if (right_side[index] == 1 && left_side[index] == 0) {
    } else if (right_side[index] == 1 && left_side[index] != 0) {
      if (t_ans != 0) t_ans--;
    }
    chmax(ans, t_ans);
    right_side[index]--;
    left_side[index]++;
  }
  cout << ans << "\n";
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n;
    cin >> n;

    // 処理
    // 出力
    cout << n / 3 << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
         
        int n = sc.nextInt();
        int min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;
        long sum = 0L;
        for (int i=0; i<n; i++) {
            int temp = sc.nextInt();
            min = Math.min(min, temp);
            max = Math.max(max, temp);
            sum += temp;
        }
        System.out.println(min+" "+max+" "+sum);
         
    }
}


Measured memory_bytes: 42452
#include <iostream>

#include <vector>

#include <algorithm>

#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <ctime>

#include <cctype>

#include <cstring>

#include <utility>

#include <map>

using namespace std;

typedef pair<int,int> P;

typedef long long ll;

int main()

{

    int n;

    cin>>n;

    vector<int> a(n);

     vector<int> b(n);

     vector<int> c(n);

    for(int i=0;i<n;i++)

        cin>>a[i];

    for(int i=0;i<n;i++)

        cin>>b[i];

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

        cin>>c[i];

    int sum=0;

    for(int i=0;i<n;i++)

    {

        sum+=b[i];

        if(i>0)

        {

            if(c[a[i-1]-1]&&a[i]==a[i-1]+1)

                sum+=c[a[i-1]-1];

        }

    }

    cout<<sum<<endl;

    return 0;

}



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

int main(){
    int x, n;
    cin >> x >> n;
    int ans =0, dif = 102, t = 0 ;
    vector<int> fbd(n);
    vector<int> vec(102);
    for (int i = 0; i < 102; i++) vec.at(i) = i;


    for (int i = 0; i < n; i++){
        cin >> fbd.at(i);
    }

    for (int i = 0; i < n; i++){
        vec.at(fbd.at(i)) = 0;
    }

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

    for (int i = 0; i < 102; i++){
        if (vec.at(i) < x){
            t = x - vec.at(i);
        }else{
            t = vec.at(i) - x;
        }
        if(t < dif){
            dif = t;
            ans = vec.at(i);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    ll X;
    cin >> X;
    ll ans = 0;
    for (int i = 1; i < 1000;i++)
    {
        for (int j = 2; j <= 1000;j++)
        {
            ll pre = pow(i, j);

            if (pre <= X)
            {
                ans = max(ans, pre);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	const int M = 256;
	int N;
	while (cin >> N && N) {
		int I[256];
		for (int i=1; i<=N; ++i) cin >> I[i];
		double Hmin = 1000.0;
		int s, a, c, upper = N;
		for (int S=0; S<=15; ++S) {
			for (int A=0; A<=15; ++A) {
				for (int C=0; C<=15; ++C) {
					int x[256] = {0};
					int R = S;
					int O;
					int cnt = 0;
					for (int i=1; i<=N; ++i) {
						R = (A * R + C) % M;
						O = (I[i] + R) % M;
						cnt += x[O] == 0;
						if (upper < cnt) break;
						x[O] ++;
					}
					if (cnt <= upper) {
						upper = cnt;
						double H = 0;
						for (int i=0; i<256; ++i) {
							if (x[i]) H -= (double)x[i] / N * log((double)x[i] / N);
						}
						if (H + 1e-9 < Hmin) {
							Hmin = H;
							s = S;
							a = A;
							c = C;
						}
					}
				}
			}
		}
		cout << s << " " << a << " " << c << endl;
	}
	return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmp,data,m,h,x,y,xcmp=0,ycmp=0,sum=0;

string s,w;

vector<int> z;

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

        bool fl=false;
       cin >> s;
       if(s.size()==1){
           Cout("No");
           return 0;
       }
       rep(i,s.size()){
           if(s[i]=='N'){
               rep(j,s.size()){
                   if(s[j]=='S'){
                       fl=true;
                   }
               }
               if(fl==false){
                   Cout("No");
                   return 0;
               }
           }
           fl=false;
           
           if(s[i]=='E'){
               rep(j,s.size()){
                   if(s[j]=='W'){
                       fl=true;
                   }
               }
               if(fl==false){
                   Cout("No");
                   return 0;
               }
           }
           fl=false;
           
           if(s[i]=='W'){
               rep(j,s.size()){
                   if(s[j]=='E'){
                       fl=true;
                   }
               }
               if(fl==false){
                   Cout("No");
                   return 0;
               }
           }
           fl=false;
           
           if(s[i]=='S'){
               rep(j,s.size()){
                   if(s[j]=='N'){
                       fl=true;
                   }
               }
               if(fl==false){
                   Cout("No");
                   return 0;
               }
           }
           fl=false;
       }
       Cout("Yes");
return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long n, sub = 10, ans = 0, sub2 = 50, sub4 = 2;
    cin >> n;
    if(n % 2 != 0)
    {
        cout << 0 << endl;
    }
    else
    {
        while(sub <= n)
        {
            ans += n / sub;
            sub *= 5;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3528
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
	string S,T;
	cin >> S>>T;
	sort(S.begin(), S.end());
	sort(T.begin(), T.end(), greater<char>());
	if (S < T)cout << "Yes";
	else cout << "No";
}

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

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b){
  return a/gcd(a,b) * b;
}
ll func2(ll n){
  ll res = 0;
  while(n%2 == 0){
    n /= 2;
    res++;
  }
  return res;
}

ll zyou(ll a,ll b){//a＾b
  ll res = 1;
  for(int i = 1;i<=b;i++){
    res *= a;
  }
  return res;
}
struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t),weight(w){ }
};

typedef pair<int,int> P;
using Graph = vector<vector<Edge>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}


bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}

bool palin(string S){//回文判定
  int n = S.size();
  bool flag = true;
  if(n%2 == 0){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  else if(n%2 == 1){
    for(int i = 0;i<=n/2-1;i++){
      if(S[i] != S[n-i-1]){
        flag = false;
        break;
      }
    }
  }
  return flag;
}
void dfs(string S,int N,vector<string> &v){
  if(S.size() == N) return;
  if(S.size() == N-1){
  v.push_back(S+'A');
  v.push_back(S+'B');
  v.push_back(S+'C');
  v.push_back(S+'x');
  }
  dfs(S+'A',N,v);
  dfs(S+'B',N,v);
  dfs(S+'C',N,v);
  dfs(S+'x',N,v);
}


int main(){
  ll X;
  cin >> X;
  ll ans = (X/500)*1000 + ((X%500)/5)*5;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

void solve(istream& cin, ostream& cout) {
  int n, k;
  cin >> n >> k;
  // 10^100 の数, 余りのバリエーションを数える
  // a * 10^100 + b とし，考えられる (a,b) の組を考える
  mint ans = 0;
  for (ll a = k; a <= n + 1; a++) {
    ll min_b = a * (a - 1) / 2;
    ll max_b = (n * 2 - a + 1) * a / 2;
    ans += max_b - min_b + 1;
    // mint(10 * a + b)
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;
void File(){
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
}
#define REP(i,a,b) for(register int i=a;i<=b;++i)
#define DREP(i,a,b) for(register int i=a;i>=b;--i)
#define MREP(i,x) for(register int i=beg[x];i;i=E[i].last)
#define ll long long
#define inf INT_MAX
const int maxn=2e5+10;
int n;
ll a[maxn],sum[maxn],ans;
map<ll,ll>b;
int main(){
	//File();
	scanf("%d",&n);
	REP(i,1,n)scanf("%lld",&a[i]);
	REP(i,1,n)sum[i]=sum[i-1]+a[i];
	b[0]=1;
	REP(i,1,n){
		ans+=b[sum[i]];
		++b[sum[i]];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dy[4]={1,0,-1,0};
int dx[4]={0,1,0,-1};
vector<vector<int>> graph;
bool sort_sec(const pair<int,int> &a,const pair<int,int> &b){
   if(a.second<b.second){
      return true;
   }
   return false;
}
int main(void){
   string S,T;
   cin>>S>>T;
   int N=S.size();
   int M=T.size();
   string ans="-";
   for(int i=0;i<=N-M;i++){
      string S2=S;
      bool flag=true;
      for(int j=0;j<M;j++){
         if(S[i+j]!='?'&&S[i+j]!=T[j]){
            flag=false;
         }
         S2[i+j]=T[j];
      }
      if(flag){
         replace(S2.begin(),S2.end(),'?','a');
         ans=S2;
      }
   }
   if(ans=="-"){
      cout<<"UNRESTORABLE"<<endl;
   }else{
      cout<<ans<<endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <string>
using namespace std;
int main()
{
    string s,t,u;
    int a,b;
    cin>>s;
    cin>>t;
    cin>>a>>b;
    cin>>u;
    if(u==s){
        a--;
    }
    else{b--;
    }
    cout<<a<<" "<<b;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  ll N; cin>>N;
  ll x[N]; CINA(x,N);
  ll y[N]; REP(i,N){y[i] = x[i];}
  sort(y,y+N);
  ll m1 = y[N/2-1];
  ll m2 = y[N/2];
  REP(i,N){
    if(x[i]<=m1){cout << m2 << "\n";}
    else{ cout << m1 << "\n";}
  }
  
}

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	vector<int> v(n);
	vector<bool> vu(2*k+1);
	for (int i=0; i<n; ++i) cin >> v[i];
	for (int i=0; i<=k; ++i){
		if (!vu[i]){
			for (int k:v) vu[i+k]=true;
		}
	}
	if (vu[k]) cout << "First";
	else cout << "Second";
	return 0;
}

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

int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;
  int k;
  cin >> k;
  
  if(k<e-a)
    cout << ":(" << endl;
  else
    cout << "Yay!" << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  std::string A, B, C;

  std::cin >> A;
  std::cin >> B;
  std::cin >> C;

  int a, b, c;
  a = b = c = 0;
  char next = 'a';
  while(1) {
    if (next == 'a') {
      next = A[a];
      if (a == (int)A.size()) {
        std::cout << "A" << std::endl;
        break;
      }
      a++;
    }

    if (next == 'b') {
      next = B[b];
      if (b == (int)B.size()) {
        std::cout << "B" << std::endl;
        break;
      }
      b++;
    }

    if (next == 'c') {
      next = C[c];
      if (c == (int)C.size()) {
        std::cout << "C" << std::endl;
        break;
      }
      c++;
    }
  }

  return 0;
}


Measured memory_bytes: 256
import Control.Monad
import Control.Applicative
import Data.List
import Data.List.Split

data Vec = Vec Double Double

crossp :: Vec -> Vec -> Double
crossp (Vec x1 y1) (Vec x2 y2) = x1 * y2 - x2 * y1

eps :: Double
eps = 0.0000000001

main = do
  xs <- input (map read . splitOn ",") :: IO [[Double]]
  mapM_ putStrLn $ solve xs

solve :: [[Double]] -> [String]
solve = map isConvex

isConvex :: [Double] -> String
isConvex [xa, ya, xb, yb, xc, yc, xd, yd] | ca > eps && cb > eps && cc > eps && cd > eps = "YES"
                                          | ca < (-eps) && cb < (-eps) && cc < (-eps) && cd < (-eps) = "YES"
                                          | otherwise = "NO"
  where
    ca = crossp (Vec (xb - xa) (yb - ya)) (Vec (xc - xb) (yc - yb))
    cb = crossp (Vec (xc - xb) (yc - yb)) (Vec (xd - xc) (yd - yc))
    cc = crossp (Vec (xd - xc) (yd - yc)) (Vec (xa - xd) (ya - yd))
    cd = crossp (Vec (xa - xd) (ya - yd)) (Vec (xb - xa) (yb - ya))

input :: (String -> a) -> IO [a]
input f = map f . lines <$> getContents 

Measured memory_bytes: 4252
def gcd(a,b)
	if(a>b)
		return gcd(b,a)
	end
	if(b%a == 0)
		return a
	else
		return gcd(a,b%a)
	end
end
def lcm(a,b)
	a/gcd(a,b)*b
end
def nlcm(arr)
	if(arr.size==1)
		return arr[0]
	end
	lcm = arr[0]
	1.upto(arr.size-1){|i|
		lcm = lcm(lcm, arr[i])
	}
	lcm
end

N,_=gets.chomp.split(' ').map{|n| n.to_i}
A=gets.chomp.split(' ').map{|n| n.to_i}
lcm = nlcm(A)
puts A.inject(0){|sum,a| sum += (lcm-1) % a}



Measured memory_bytes: 27900
//21171_somesh || asomesh999

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define io ios::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
long int mod=1000000007;

int main()
{
	io
	#ifdef CODE
		clock_t startTime = clock();
		freopen("input.txt","r",stdin);
	#endif

	string s, t;
	cin >> s >> t;
	cout << t << s;

	#ifdef CODE
		cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
	#endif
	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);
		int H, W;
		while (true) {
			H = sc.nextInt();
			W = sc.nextInt();

			if (H == 0 && W == 0)
				break;
			
			printFrame(H,W);

		}
	}

	public static void printFrame(int H, int W) {
		for (int i = 0; i < W; i++)
			System.out.print("#");

		System.out.println();

		for (int i = 2; i < H; i++) {
			for (int j = 1; j < W; j++) {
				if (j == 1)
					System.out.print("#");
				else if (j == (W - 1)){
					System.out.println("#");
					break;
				}

				System.out.print(".");
			}

		}
		for (int i = 0; i < W; i++)
			System.out.print("#");
		
		System.out.println();
		System.out.println();


	}

}

Measured memory_bytes: 32576
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<long long,long long>
#define INF 1000000000000000000
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<int, int> mp;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>h(n + 1); h[n] = 0; rep(i, n)cin >> h[i];
	int ans = 0;
	for (int i = 1; i <= 100; i++) {
		for (int j = 0; j < n; j++) {
			if (h[j] >= i && h[j + 1] < i)ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

ll dp[110000][3];

int main() {
    int n; cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i, n) cin >> a[i] >> b[i] >> c[i];
    rep(i, 110000) rep(j, 3) dp[i][j] = 0;
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    Rep(i, 1, n) {
        chmax(dp[i][0], max(dp[i-1][1], dp[i-1][2]) + a[i]);
        chmax(dp[i][1], max(dp[i-1][0], dp[i-1][2]) + b[i]);
        chmax(dp[i][2], max(dp[i-1][1], dp[i-1][0]) + c[i]);
    }
    cout << max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]) << endl;
}

Measured memory_bytes: 3968
N = int(input())
arr = [int(n) for n in input().split()]
arr.sort()
res = 0
for i in range(N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      if len({arr[k], arr[i], arr[j]}) == 3 and arr[k] < arr[i] + arr[j]:
        res += 1
print(res)

Measured memory_bytes: 9200
N,K,Q=map(int,input().split())
a = [int(input()) for i in range(Q)]
point=[0 for i in range(N)]
for i in range(Q):
  point[a[i]-1]=point[a[i]-1]+1
for j in range(N):
  if point[j]>=Q-K+1:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 56664