akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

//https://beta.atcoder.jp/contests/agc028/tasks/agc028_a

public class Program_AGC028_A // ←Class名変更！！
{


    public static void Main(string[] args)
    {
        var st = Console.ReadLine();
        var s = Console.ReadLine();
        var t = Console.ReadLine();

        var l = Lcm(s.Length, t.Length);
        //var l = (int)ll;
        //        var x = new char[l + 1];
        var x = new Dictionary<long, char>();

        //char[] x = null;

        //for (int cm = 1; cm < 10000; cm++)
        //{
        //var isCorrect = true;
        //var l = Lcm(s.Length, t.Length) * cm;
        //x = new char[l + 1];

        for (int i = 0; i < s.Length; i++)
        {
            var pos = i * (l / s.Length) ;
            x[pos] = s[i];
        }


        for (int i = 0; i < t.Length; i++)
        {
            var pos = i * (l / t.Length) ;
            if (x.ContainsKey(pos))
            {
                if (x[pos]!=t[i])
                {
                    Console.WriteLine(-1);
                    return;

                }
            }
            //else
            //{
            //    x.Add(pos, t[i]);
            //}
        

            //if (x[pos] != t[i] && x[pos] != '\0')           /////////////////////////
            //{
            //    Console.WriteLine(-1);
            //    return;
            //    //isCorrect = false;
            //    //    continue;
            //}
        }

        //if (isCorrect)
        //{
        //    Console.WriteLine(x.Length - 1);
        //    return;
        //}
        // }


        Console.WriteLine(l);
        // Console.WriteLine( - 1);

    } // Main



    //// 最小公倍数 least common multiple 
    //public static int Lcm(int a, int b)
    //{
    //    return a * b / Gcd(a, b);
    //}

    //// ユークリッドの互除法 
    //public static int Gcd(int a, int b)
    //{
    //    if (a < b)
    //        // 引数を入替えて自分を呼び出す
    //        return Gcd(b, a);
    //    while (b != 0)
    //    {
    //        var remainder = a % b;
    //        a = b;
    //        b = remainder;
    //    }
    //    return a;
    //}




  
static long Gcd(long a, long b)
    {
        return (a < b) ? Gcd(b, a)
             : (b > 0) ? Gcd(b, a % b)
                       : a;
    }

    static long Lcm(long a, long b)
    {
        return a / Gcd(a, b) * b;
    }


    static long gcd(long a, long b)
    {
        long c = Math.Max(a, b) % Math.Min(a, b);
        b = Math.Min(a, b);
        while (c != 0)
        {
            a = b % c;
            b = c;
            c = a;
        }
        return b;
    }

}     // Class




Measured memory_bytes: 19936
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
ll const inf = 1e17;

template<class T> using PQ_G = priority_queue<T, vector<T>, greater<T>>;

ll N, M, X;
vector<ll> v;
vector<vector<pair<int, ll>>> G;

ll solve() {
  vector<ll> dist(N+1, inf);
  
  PQ_G<tuple<ll, ll, int>> pq;
  pq.emplace(0, X, 0);
 
  while(!pq.empty()) {
    ll T, H; int curr; tie(T, H, curr) = pq.top(); pq.pop();

    if(curr == N-1) {
      ll nT = T + v[N-1] - H;
      if(dist[N] > nT) {
        dist[N] = nT;
        pq.emplace(nT, v[N-1], N);
      }
      continue;
    }

    if(curr == N) return T;

    for(auto& e: G[curr]) {
      int next; ll mvt; tie(next, mvt) = e;
      ll nT = T + mvt;
      ll nH = H - mvt;
      if(H - mvt < 0) {
        if(H + (mvt - H) > v[curr]) continue;
        nT += mvt - H;
        nH = 0;
      }
      else if(H - mvt > v[next]) {
        nT += (H - mvt) - v[next];
        nH = H - ((H - mvt) - v[next]) - mvt;
        if(nH < 0) continue;
      }

      if(dist[next] > nT) {
        dist[next] = nT;
        pq.emplace(nT, nH, next);
      }
    }
  }
  return -1;
}

int main() {

  cin >> N >> M >> X;
  v.resize(N);
  G.resize(N);
  rep(i, N) cin >> v[i];
  rep(i, M) {
    int x, y; ll t; cin >> x >> y >> t;
    x --, y --;
    if(t <= v[x]) G[x].emplace_back(y, t);
    if(t <= v[y]) G[y].emplace_back(x, t);
  }

  cout << solve() << endl;
  
  return 0;
}

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

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int[] nums = new int[4];
        for (int i = 0; i < nums.length; i++)
            nums[i] = sc.nextInt();
        if (nums[2] > nums[1] || nums[3] < nums[0]) {
            System.out.println(0);
            return;
        }
        Arrays.sort(nums);
        System.out.println(nums[2] - nums[1]);
    }
}


Measured memory_bytes: 21716
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)

int main() {
    ll N;
    cin >> N;
    vector<vector<ll>> A(2,vector<ll>(N));
    rep(i,2){
        rep(j,N){
            cin >> A[i][j];
        }
    }

    ll ans=0;
    ll tmp=0;
    rep(i,N){
        ll result=0;
        ll j;
        for(j=0;j<=tmp;j++){
            result += A[0][j];
        }
        j -= 1;
        for(j=j;j<N;j++){
            result += A[1][j];
        }

        ans = max(ans,result);
        tmp++;
        
    }

    cout << ans << endl;
}


Measured memory_bytes: 3608
s = input()
n = len(s)
r = l = 0
point = -1

flag = 0
ans = [0] * n


for i in range(n):
    if (s[i] == 'R' and s[i + 1] == 'L'):
        r += 1
        point = i
        ans[point] += (r+1) // 2
        ans[point + 1] += (r) // 2
        r = l = 0
    elif s[i] == 'L' and (i == n-1 or s[i + 1] == 'R'):
        l += 1
        ans[point+1] += (l+1) // 2
        ans[point] += (l ) // 2
        l = r = 0
    elif s[i] == 'R':
        r += 1
        l = 0
    elif s[i] == 'L':
        l += 1
        r = 0

print(' '.join(map(str, ans)))


Measured memory_bytes: 17316
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define enter "\n"

typedef long long ll;


int abc098_a(){
    //入力
    int a,b;
    cin >> a >> b;
    int ans;
    
    //処理
    ans = max(a+b,a-b);
    ans = max(a*b,ans);
    
    //出力
    cout << ans << enter;
    return 0;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, a, b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int abc = 0;
    int clas=0;
    for(int i=0; i<n; i++){
        if(s[i]=='b'){
            abc++;
            if(clas <= a+b-1 && abc <= b){
                clas++;
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }else if(s[i]=='a'){
            if(clas <= a+b-1){
                clas++;
                cout << "Yes" << endl;
            }else{
                cout << "No" << endl;
            }
        }else{
            cout << "No" << endl;
        }
    }
}




Measured memory_bytes: 896
N,K=map(int,input().split())
P=10**9+7


def Kai(a):
    ans=1
    for i in range(1,a+1):
        ans*=i
    return ans


for i in range(1,K+1):
    
    if(N-K+1<i):
        print(0)
        continue
    kukan=(Kai(N-K+1)//Kai(i)//Kai(N-K-i+1))%P
    #print(kukan)
    haibun=(Kai(K-1)//Kai(K-i)//Kai(i-1))%P
    print((kukan*haibun)%P)



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

int main()
{
    int N;
    cin >> N;
    for(int i=0;i<N;i++){
        char c;
        cin >> c;
        if(c=='Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
    int2(h, w);
    vector<string> board(h);
    rep(i, h) cin >> board[i];

    int ans = 0;
    rep(x, h) rep(y, w) rep(i, h) rep(j, w) {
        if (board[x][y] == 'B' && 
                board[i][j] == 'B') {
            ans = max(ans, abs(i-x) + abs(j-y));
        }
    }

    std::cout << ans << std::endl;

    return 0;
}



Measured memory_bytes: 3260
n,m=list(map(int,input().split()))
d=[0]*(m+1)
for i in range(n):
    v,w=map(int,input().split())
    for j in range(m+1-w):
        if d[m-j]<d[m-j-w]+v:
            d[m-j]=d[m-j-w]+v
print(max(d))



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

typedef long long LL;
#define dbg(x) cout << #x"=" << x << endl; 
const int MAX_N = 550;
LL n,K;
LL A[MAX_N];
LL B[MAX_N];

bool check(int F){
    LL sum = 0;
    for(int i = 1; i <= n; ++i) {
        B[i] = A[i]%F;
        sum += B[i];
    }
    sort(B+1, B+1+n);
    LL ans = 0;
	int l = 1, r = n;
    LL ch = 0;
	while(l <= r){
		if(ch > 0){
			ch = ch - B[l];
			ans = ans + B[l];
			l++;
		}
		else{
			ch = ch + F - B[r];
			r--;
		}
	}
    return ans <= K;
}

int main(){ 
   // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n >> K;
    LL sum = 0;
    for(int i = 1; i <= n; ++i){
        cin >> A[i];
        sum += A[i];
    }
    int ans = 1;
    for(int i = 1; i <= sum/i; ++i){
        if(sum%i == 0){
            if(check(sum/i)){
                ans = sum/i;
                break;
            } else if(check(i)){
                ans = max(ans, i);
            }
        }
    }
    cout << ans << endl; 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
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 pair<int, int> PII;
typedef pair<long, long> PLL;
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 SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const double INF=1e9;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
 const int MAX_N=10010;
int par[MAX_N];
int rnk[MAX_N];
void init(int n){
	REP(i,n){
		par[i]=i;
		rnk[i]=0;
	}
}
int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}

void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return;
	if(rnk[x]<rnk[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(rnk[x]==rnk[y])rnk[x]++;
	}
}

bool same(int x,int y){
	return find(x)==find(y);
}
int main(){
	int N,Q;
	cin>>N>>Q;
	init(N);
	REP(i,Q){
		int c,x,y;
		cin>>c>>x>>y;
		if(c==0)unite(x,y);
		else cout<<same(x,y)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1236
import java.util.*;
public class Main{
    public static void main(String[] args){
 
    int N,K,x,flg;
    int t[] = new int[100];
    Scanner scan = new Scanner(System.in);
    while(true){
        N=scan.nextInt();
        K=scan.nextInt();
        if(N==0&&K==0)break;
        flg=1;
        for(int i=0;i<K;i++)t[i]=scan.nextInt();
        for(int i=0;i<N;i++){
        for(int j=0;j<K;j++){
            x=scan.nextInt();
            t[j]-=x;
            if(t[j]<0)flg=0;
        }
        }
        if(flg==1){
        System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
    }
}

Measured memory_bytes: 94964
fn main() {
    let (n, max_w) = read_tuple();
    let items = read_vec2::<u64>(n as u32);
    let mut dp: Vec<Vec<u64>> = Vec::new();
    for _ in 0..n {
        let v = vec![0; max_w + 1];
        dp.push(v);
    }
    let ini_w = items[0][0];
    let ini_v = items[0][1];
    dp[0][ini_w as usize] = ini_v;

    let mut max_v: u64 = ini_v;
    for i in 0..n-1 {
        for w in 0..max_w+1 {
            if w != 0 && dp[i][w] == 0 {
                continue;
            }
            let cur_dp = dp[i][w];
            let next_w = items[i+1][0];
            let next_v = items[i+1][1];
            if w + next_w as usize <= max_w {
                chmax(&mut dp[i+1][w+next_w as usize], cur_dp + next_v);
                chmax(&mut max_v, dp[i+1][w+next_w as usize]);
            }
            chmax(&mut dp[i+1][w], cur_dp);
            chmax(&mut max_v, dp[i+1][w]);
        }
    }
    println!("{}", max_v);
}

fn chmax(a: &mut u64, b: u64) {
    if *a < b {
        *a = b;
    }
}

fn read_tuple() -> (usize, usize) {
    let v = read_vec::<usize>();
    (v[0], v[1])
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}


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

int main(){

	long long int n,k;
	cin>>n>>k;
	long long int h[n+1];
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	long long int dp[n+1];
	for(long long int i=0;i<=n;i++){
		dp[i]=1e9+5;
	}
	dp[1]=0;
	for(long long int i=2;i<=n;i++){
		long long int min1=1e9+5;
		for(long long int j=1;j<=k;j++){
			if(i-j>0){
				min1 = min(min1,dp[i-j]+abs(h[i]-h[i-j]));
			}
			else{
				break;
			}
		}
		dp[i]=min1;
	}
	cout<<dp[n]<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
	int n; cin >> n;
	int x = 1;
	while(true){
		if (x*2 > n){
			break;
		}
		x *= 2;
	}
	cout << x << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include<string>
#include<stack>

using namespace std;
typedef long long ll;

int main(){
    int n = 5;
    int answer;
    for(int i=0;i<5;i++){
        int el;
        cin>>el;
        if(el == 0){
            answer = i+1;
        }
    }
    cout<<answer<<"\n";
}

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

int main() {
  string S;
  cin>>S;
  int x;
  x=S.size();
  int answer;
  answer=1;
  for(int i=0;i<x;i+=2){
    if(S.at(i)=='L'){
      answer=0;
    }
  }
  for(int i=1;i<x;i+=2){
    if(S.at(i)=='R'){
      answer=0;
    }
  }
  if(answer==1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

int main(){
	int a, b; cin >> a >>  b; cout << a*b << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  vector<int> B(N);
  for(int i=0; i<N; i++){
    cin >> B.at(i);
  }
  vector<int> vec(N);
  vector<bool> end(N,false); 
  vec.at(0) = A.at(0);
  end.at(0) = true;
  vec.at(N-1) = B.at(N-1);
  end.at(N-1) = true;
  for(int i=1; i<N; i++){
    if(end.at(i)){
      if(A.at(i) < B.at(i)){
        vec.at(i) = 0;
      }
    }   
    else if(A.at(i) != A.at(i-1)){
      vec.at(i) = A.at(i);
      end.at(i) = true;
    }
    else{
      vec.at(i) = A.at(i);
    }
  }
  for(int i=N-2; i>=0; i--){
    if(B.at(i) != B.at(i+1)){
      if(end.at(i) && A.at(i) != B.at(i)){
        vec.at(i) = 0;
      }
      else{
        vec.at(i) = B.at(i);
        end.at(i) = true;
      }
    }
    else{
      if(end.at(i) && vec.at(i) > B.at(i)){
        vec.at(i) = 0;
      }
      else if(end.at(i)){
        continue;
      }
      else{
        vec.at(i) = min(vec.at(i), B.at(i));
      }
    }
  }
  
  int64_t ans = 1;
  int64_t MOD = 1000000007;
  
  for(int i=0; i<N; i++){
    if(end.at(i) && vec.at(i) > 0){
      continue;
    }
    else{
      ans *= vec.at(i);
      ans %= MOD;
    }
  }
  if(N == 1 && (A.at(0) != B.at(0))){
    ans = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

//全探索だというヒントを聞いて解答

int main(){
    ll n, m, k; cin >> n >> m >> k;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    vector<ll> b(m); rep(i,m) cin >> b[i];

    ll ans = 0;
    ll topB = 0; 
    ll sumB = accumulate(b.begin(), b.end(), 0LL);

    vector<ll> cumA(n+1);
    cumA[0] = 0;
    cumA[1] = a[0];
    for(int i = 2; i <= n; i++) cumA[i] = a[i-1] + cumA[i-1];

    vector<ll> cumB(m+1);
    cumB[0] = 0;
    cumB[1] = b[0];
    for(int i = 2; i <= m; i++) cumB[i] = b[i-1] + cumB[i-1];

    for(int i = 0; i <= m; i++){
        if(cumB[i] > k){
            topB = i-1;
            //ans = max(ans,topB);
            break;
        }else{
            topB = i;
            //ans = max(ans,topB);
        }
    }
    
    //cout << "cumA:"; for(auto x:cumA) cout << x << " "; cout << endl;
    //cout << "cumB:"; for(auto x:cumB) cout << x << " "; cout << endl;

    for(int i = 0; i <= n; i++){
        for(; cumA[i] + cumB[topB] > k;){
            if(topB == 0) break; 
            topB--;
        }
        //if(topB < 0) break; 
        if(cumA[i] + cumB[topB] <= k)
            ans = max(ans, i + topB);
        
        //cout << "i:" << i << " topB:" << topB << " ans:" << ans << endl;
    }

    put(ans);
}


Measured memory_bytes: 9576
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  int f=0;
  int s=0;
  int p=0;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(f<=a){
      s=f;
      f=a;
      p=i;
    }else if(s<a)
      s=a;
  }
  for(int i=0;i<n;i++)
    cout<<(p!=i?f:s)<<endl;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
bool isprime(int x){
	if(x==0||x==1)return 0;
	for(int i=2;i<=sqrt(x);i++)
		if(x%i==0)
			return 0;
	return 1;
}
int main(){
	int x;
	cin>>x;
	while(!isprime(x))x++;
	cout<<x;
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize,s: String};
    let s: String = s;

    let mut v: Vec<char> = Vec::new();
    let mut count = 0;
    let mut red_count = 0;
    let mut index = 0;
    let mut red_d = 0;

    for c in s.as_str().chars() {
        if c == 'R' {
            red_count += 1;
        }

        v.push(c);
    }

    for i in 0..red_count {
        if v[i] == 'W' {
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 3356
#include <cstdio>
#include <algorithm>
int main(){
    int a,b,c,d;
    int x,y;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a<b){
        x=a;
    }
    else{
        x=b;
    }
    if(c<d){
        y=c;
    }
    else{
        y=d;
    }
    int sum=x+y;
    printf("%d",sum);
}



Measured memory_bytes: 1644
MOD = 2019
l, r = map(int, input().split())
ldiv = l // MOD
rdiv = r // MOD

if l % 2019 == 0 or r % 2019 == 0 or rdiv - ldiv > 0:
    print(0)
else:
    queue = []

    for i in range(1, MOD):
        counter = 0
        for j in range(ldiv, rdiv + 1):
            if l <= j * MOD + i <= r:
                counter += 1
                if counter > 1:
                    break
        if counter > 1:
            queue.append(i)
            queue.append(i)
        elif counter > 0:
            queue.append(i)

    l = len(queue)
    res = float("inf")
    for i in range(l):
        for j in range(i + 1, l):
            res = min(res, (queue[i] * queue[j]) % MOD)

    print(int(res))

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

int x[200000], y[200000], n, w, h, x_1, y_1, w1, ok = true;
int main() {
	cin >> n >> w >> h;
	for (int i = 0; i < n; i++) {
		cin >> x_1 >> y_1 >> w1;
		x[max(0, x_1 - w1)]++;
		y[max(0, y_1 - w1)]++;
		x[min(w, x_1 + w1)]--;
		y[min(h, y_1 + w1)]--;
	}
	for (int i = 1; i < w; i++) {
		x[i] += x[i - 1];
	}
	for (int i = 1; i < h; i++) {
		y[i] += y[i - 1];
	}
	for (int i = 0; i < w; i++) {
		if (x[i] == 0) { ok = false; }
	}
	for (int i = 0; i < h; i++) {
		if (y[i] == 0 && ok == false) { cout << "No" << endl; return 0; }
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int X,Y;
  cin>>X>>Y;

  int ans=0;
  if(X==1) ans+=3;
  else if(X==2) ans+=2;
  else if(X==3) ans+=1;

  if(Y==1) ans+=3;
  else if(Y==2) ans+=2;
  else if(Y==3) ans+=1;

  if(X==1&&Y==1) ans+=4;

  cout<<ans*100000<<endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
preorderList = [int(i) for i in input().split()]
inorderList = [int(i) for i in input().split()]

class Node:
    def __init__(self, idn):
        self.id = idn
        self.left = -1
        self.right = -1
T = [Node(i+1) for i in range(n)]

def splitTree(P, I):
    b = I.index(P[0])
    if P[0] != I[0]:
        T[P[0]-1].left = P[1]
    if P[0] != I[-1]:
        T[P[0]-1].right = P[b+1]
    if b > 1:
        splitTree(P[1:b+1], I[:b])
    if b < len(I)-2:
        splitTree(P[b+1:], I[b+1:])

splitTree(preorderList, inorderList)
root = preorderList[0]

postorderList = []
def setPostorderList(p):
    if T[p-1].left != -1:
        setPostorderList(T[p-1].left)
    if T[p-1].right != -1:
        setPostorderList(T[p-1].right)
    postorderList.append(T[p-1].id)

setPostorderList(root)
print(*postorderList)



Measured memory_bytes: 5612
public class Main {

  private static void solve() {
    double a = ni();
    double b = ni();
    double x = ni();

    double left = 0;
    double right = 90;
    for (int i = 0; i < 50; i++) {
      double k = (left + right) / 2;
      double theta = k / 180 * Math.PI;
      double l = Math.tan(theta) * b;
      double y;
      if (l < a) {
        y = b * l * a / 2;
      } else {
        y = (b * 2 - a / Math.tan(theta)) * a * a / 2;
      }
      if (y > x) {
        right = k;
      } else {
        left = k;
      }
    }
    System.out.println(90 - left);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}



Measured memory_bytes: 22484
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
	int i = 0, N;
	cin >> N;

	vector<int> high(N);

	while (i < N) {
		cin >> high.at(i);
		i++;
	}

	int j = 0, k = 0, ans = 0;
	while (j < N) {
		while (k < j) {
			if (high.at(k) > high.at(j)) {
				break;
			}
			k++;
		}
		if (k == j) {
			ans++;
		}
		k = 0;
		j++;
	}
	
	cout << ans << endl;
	
	return 0;
}

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

const int MOD = 1000000000 + 7;
const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];

void comb_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long mod_comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;

}

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

    comb_init();

    for (int i = 1; i <= k; i++) {
        cout << (mod_comb(n - k + 1, i) * mod_comb(k - 1, i - 1)) % MOD << endl;
    }
}

Measured memory_bytes: 256
// 

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int main() {
    int r;
    cin >> r;
    cout << 3 * r * r << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define INF  (1<<30)
#define INFL (1LL<<60)
#define EPS ((ld)(1e-9))
 
#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define rep(i, e) for (int i = 0, _##i = (e); i < _##i; i++)
#define repp(i, s, e) for (int i = (s), _##i = (e); i < _##i; i++)
#define repr(i, s, e) for (int i = (s)-1, _##i = (e); i >= _##i; i--)
#define repi(i, x) for (auto &i : (x))
#define ARR(...) vector<int>({__VA_ARGS__})
#define ARS(...) vector<string>({__VA_ARGS__})
 
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef complex<double> base;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << '(' << pai.first << ' ' << pai.second << ')';
}
 
template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    cout << '[';
    for (auto p : v) cout << p << ",";
    cout << "]";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const set<T, V> v) {
    cout << "{";
    for (auto p : v) cout << p << ",";
    cout << "}";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> v) {
    cout << "{";
    for (auto p : v) cout << p << ",";
    cout << "}";
    return os;
}
 
#ifndef __SOULTCH
#define debug(...) 0
#define endl '\n'
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif
 
template<typename T> void get_max(T &a, T b) {a = max(a, b);}
template<typename T> void get_min(T &a, T b) {a = min(a, b);}

const ll MOD = 1e9+7;

int N;
string s;
ll dp[3000][3000];

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> N >> s;
    
    dp[0][0] = 1;
    repp(i, 1, N) {
        char c = s[i-1];
        if (c == '<') {
            ll s = 0;
            rep(j, i) {
                s += dp[i-1][j];
                s %= MOD;
                dp[i][j+1] = s;
            }
        } else {
            ll s = 0;
            repr(j, i, 0) {
                s += dp[i-1][j];
                s %= MOD;
                dp[i][j] = s;
            }
        }
    }

    // rep(i, N) rep(j, i+1) debug(i, j, dp[i][j]);

    cout << accumulate(dp[N-1], dp[N-1]+N, 0LL)%MOD << endl;
}

Measured memory_bytes: 68864
import java.util.Scanner;
import java.util.Arrays;
import java.util.Comparator;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    int[][] a = new int[M][2];
    for (int i = 0; i < M; i++){
      a[i][0] = scanner.nextInt();
      a[i][1] = scanner.nextInt();
    }
  Arrays.sort(a, Comparator.comparingInt(o -> o[1]));

  int count = 0;
  for (int i = 0; i < M;){
    count++;
    int right = a[i][1];
    i++;
    while (i < M && a[i][0] < right){
      i++;
    }
  }
    System.out.println(count);
  }
}


Measured memory_bytes: 92860
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
int main() {
	int n;
	scanf("%d", &n);
	map<pair<int, int>, int> cnt;
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		ld a;
		scanf("%Lf", &a);
		ll x = llround(a * 1000000000);
		int p2 = 0, p5 = 0;
		while (x % 2 == 0) {
			x /= 2;
			p2++;
		}
		while (x % 5 == 0) {
			x /= 5;
			p5++;
		}
		cnt[{p2, p5}]++;
		if (p2 >= 9 && p5 >= 9) --ans;
	}
	for (auto& a : cnt)
		for (auto& b : cnt) {
			int p2 = a.first.first + b.first.first;
			int p5 = a.first.second + b.first.second;
			if (p2 >= 18 && p5 >= 18) {
				ans += (ll)a.second * b.second;
			}
		}
	assert(ans % 2 == 0);
	ans /= 2;
	printf("%lld\n", ans);
}


Measured memory_bytes: 3840
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main(){
  int N,M;
  cin >> N >> M;
  priority_queue<ll> A;
  for(int i = 0; i < N; ++i){
    ll tmp;
    cin >> tmp;
    A.push(tmp);
  }
  for(int i = 0; i < M; ++i){
    ll top = A.top();
    A.pop();
    A.push(top/2);
  }
  ll ans = 0;
  while(!A.empty()){
    ans += A.top();
    A.pop();
  }
  cout << ans << endl;

  
}


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

const int MAX_N = 1e5+2, MAX_M = 1e6+1;
ll N, M;
ll a[MAX_N];

ll lcm(ll a, ll b)
{
    return a/__gcd(a,b) * b;
}

void solve()
{
	// X = A *(2*P+1)
	for(int i=0;i<N;++i) a[i] >>= 1;
	ll L = 1;
	for(int i=0;i<N;++i){
        L = lcm(L, a[i]);
        if(L > M || L < 0){
            cout << 0 << '\n';
            return;
        }
	}
	//cout << L << '\n';
	for(int i=0;i<N;++i){
	    ll x = L / a[i];
	    if(x%2 == 0){
	        cout << 0 << '\n';
	        return;
	    }
	}
	ll res = M / L;
	if(res % 2 == 0) res--;
	cout << (res+1)/2 << '\n';
}

int main()
{
	cin >> N >> M;
	for(int i=0;i<N;++i) cin >> a[i];
	solve();
	return 0;
}

Measured memory_bytes: 4328
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
typedef vector<int> vi;
#define MOD 1000000007
#define INF 1000000000000000007LL

const int N = 200005;
 
// it's swapnil07 ;)
 
#ifdef SWAPNIL07
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define endl '\n'
#define trace(...)
#define end_routine()
#endif

int arr[N];

signed main()
{
    fast
    #ifdef SWAPNIL07
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int n; cin>>n;
    For(i, 1, n){
        int a; cin>>a;
        arr[a]++;
    }
    For(i, 1, n+1){
        cout<<arr[i]<<"\n";
    }
    return 0;
}





Measured memory_bytes: 5180
#include <bits/stdc++.h>
#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 all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n;
   cin >> n;
   vector<int> a(n + 1), b(n);
   rep(i, 0, n + 1) cin >> a[i];
   rep(i, 0, n) cin >> b[i];

   ll ans = 0;
   rep(i, 0, n) {
      int com = min(a[i], b[i]);
      ans += com;
      a[i] -= com;
      b[i] -= com;
      com = min(a[i + 1], b[i]);
      ans += com;
      a[i + 1] -= com;
      b[i] -= com;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 3904
import java.io.*;
import java.util.*;

class Main{
    public static void main(String[] a){
        int[] values = new int[10];
        Scanner scan = new Scanner(System.in);
        for(int i=0; i<10; i++)
            values[i] = scan.nextInt();
        Arrays.sort(values);
        for(int i=9; i>=7; i--)
            System.out.println(values[i]);
    }
}

Measured memory_bytes: 26204
n = int(input())
a = sorted([int(input()) for i in range(n)])
ans = 0
s = 1
for i in range(n - 1):
  if a[i] != a[i + 1]:
    ans += s % 2
    s = 1
  else:
    s += 1
ans += s % 2
print(ans)


Measured memory_bytes: 8276
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(Math.abs(x - a) > Math.abs(x - b)) {
			System.out.println("B");
		} else {
			System.out.println("A");
		}
		
	}
}


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

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
constexpr int loose = 0;
constexpr int tight = 1;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


ll dp[110][101010];
ll sum[110][101010];

void solve(){
	ll n,k;
	cin>>n>>k;
	Array a(n);
	REP(i,n) cin>>a[i];

	dp[0][0]=1;

	REP(i,n){
		REP(j,k+1){
			(sum[i][j+1] = sum[i][j] + dp[i][j])%=MOD;
			dp[i+1][j] = (MOD + sum[i][j+1]-sum[i][max(j-a[i], 0LL)])%MOD;
		}
	}

	cout<<dp[n][k]<<en;
}

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

    solve();
    return 0;
}

Measured memory_bytes: 162048
#include<stdio.h>
int main ()
{
	int x,y,z;
	scanf("%d%d%d", &x, &y, &z);
	int o = x%(y+z);
	if (o>=z)
	{
		printf("%d",x/(y+z));
	}
	else 
	{
		printf("%d",x/(y+z)-1);
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
 
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;


int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((a == b and a != c) or (a == c and a!=b) or ( b== c and a != b)) cout << "Yes" << endl;
  else cout <<"No" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.InputMismatchException;
import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
      	Map<String, Integer> map = new HashMap<>();
      	
      	Scanner sc = new Scanner(System.in);
      	sc.nextLine();
      	boolean isFirst = true;
    	while (sc.hasNextLine() && isFirst) {
      		String line = sc.nextLine();
         	if (isNumeric(line)){
            	isFirst = false;	
            }else{
          		map.merge(line, 1, Integer::sum);
            } 
          	
		}
      
      	while (sc.hasNextLine()) {
      		map.merge(sc.nextLine(), -1, Integer::sum);
		}
      
      	Integer m = 0;
      	for (Integer f : map.values()) {
    		if (f > m){
             	m = f;
            }  
		}
      	System.out.println(m);
    }
  
  	public static boolean isNumeric(String str){
  		return str.matches("-?\\d+(\\.\\d+)?");  //match a number with optional '-' and decimal.
	}
}

Measured memory_bytes: 27092
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    int Aara[100];
    int Bara[100];
    int B = 0;
    int A = 0;
    cin >> a >> b;
    for(int i = 0; i < a; i++)
    {
        B = (B*10)+b;
        //cout << B << endl;
    }
    for(int i = 0; i < b;i++)
        A = (A*10)+a;
    int m = max(A,B);
    cout << m << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
N=int(input())
ABC=[]
ABC.append(list(map(int,input().split())))
ABC.append(list(map(int,input().split())))
ABC.append(list(map(int,input().split())))
ABC[0].sort()
ABC[1].sort()
ABC[2].sort()


def bin_isOK(index,key,num):
    if ABC[num][index] >= key:
        return True
    else:
        return False


def binary_search(key,num):
    ng = -1
    ok = len(ABC[num])

    while abs(ok - ng) >1:
        mid = (ok + ng)//2

        if bin_isOK(mid,key,num):
            ok = mid
        else:
            ng = mid
    
    return ok
AonB=[0 for i in range(N)]
for i in range(N):
    AonB[i]=binary_search(ABC[1][i],0)

SAonB=[AonB[0]]

for i in range(1,N):
    SAonB.append(SAonB[i-1]+AonB[i])

ans=0
for i in range(N):
    num=binary_search(ABC[2][i],1)
    if num!=0:
        ans+=SAonB[num-1]
    
print(ans)

Measured memory_bytes: 23964
import java.util.*;

public class Main {
    public static int gcd(int a, int b) {
        if(a == 0 || b == 0) return a + b;
        return (b > a) ? gcd(b % a, a) : gcd(a % b, b);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        int A = sc.nextInt();
        int ans = gcd(A, sc.nextInt());
        for(int i = 0; i < N - 2; ++i) {
            ans = gcd(ans, sc.nextInt());
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 49340
fun main(arg: Array<String>) {
    val N = nextInt()
    val A = listOfInt()
    val M = java.util.HashMap<Int, Long>()
    A.forEach { M[it] = M.getOrElse(it, { 0 }) + 1 }
    var ans = 1L
    M.asIterable().forEach {
        val x = it.key
        val c = M.getOrElse(x - 1, { 0 }) +
                M.getOrElse(x + 0, { 0 }) +
                M.getOrElse(x + 1, { 0 })
        if (ans < c) ans = c
    }
    println(ans)
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfInt(D: Int = 0) = listOfString().map { Integer.parseInt(it) + D }
fun listOfInt(vararg deltas: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + deltas[index % deltas.size] }


Measured memory_bytes: 57884
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define reduce200ms ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(6)
#define pb push_back
#define mp make_pair
#define x first
#define y second
#define bitcount _builtin_popcount
#define fill(var,val) memset(var,val, sizeof var)
#define rep(i,a,b) for(auto i=a;i<b;++i)
#define per(i,a,b) for(auto i=a;i>b;--i)
#define elif else if
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
/*
    #ifdef DEBUG
         #define debug(args...)            {dbg,args; cerr<<endl;}
    #else
        #define debug(args...)
    #endif
    struct debugger
    {
        template<typename T> debugger& operator , (const T& v)
        {
            cerr<<v<<" ";
            return *this;
        }
    } dbg;
*/
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;

const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;

long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long double dist(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
long long min(long long a,long long b,long long c){return min(c,min(a,b));}
long long max(long long a,long long b,long long c){return max(c,max(a,b));}
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	if(_gcd!=1)cerr<<"WA";
	else return mpow(a,mod-2,mod);
}
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
int n;
int main(){reduce200ms;
cin>>n;
if(n<=999 and n>=1)cout<<"ABC";
else{
	cout<<"ABD";
}
return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll 	 long long
#define pb push_back
#define ull unsigned long long
 
using namespace std;
 
#define IOS    ios_base::sync_with_stdio(false);cin.tie(NULL);
 
 
int main() 
{ 
IOS;

int a; cin>>a;

while(a--)
{
	cout<<"ACL";
    
}
cout<<endl;
return 0; 
}

Measured memory_bytes: 3608