akhauriyash/Code-Regression huggingface dataset:
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;
ll INF=1e10;

int main(){
    ll n; cin>>n;
    vector<ll>a(n);
    map<ll,ll>mp;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll cnt=0;
    for(auto p:mp){
        cnt++;
    }
    if(cnt%2!=0)cout<<cnt<<endl;
    else cout<<cnt-1<<endl;
}





























































































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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

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

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

// const long long INF = 1LL << 60;

template <typename T>
struct Edge {
  int to;
  T cost;
};

// Dijkstra
template <typename T>
class Dijkstra {
 private:
  vector<vector<Edge<T>>> G;
  int num_v;

 public:
  Dijkstra(int num_v) : G(num_v), num_v(num_v) {
  }

  void add_edge(int from, int to, T cost) {
    G[from].push_back((Edge<T>){to, cost});
  }

  // start: Start point
  // result: result
  void solve(int start, vector<T>& result) {
    vector<int> tmp;
    solve(start, result, tmp);
  }

  void solve(int start, vector<T>& result, vector<int>& prev) {
    result.resize(num_v, INF);
    prev.resize(num_v, -1);

    // get<0>(T): cost
    // get<1>(T): index
    // get<2>(T): ... ( for extent)
    using Tup = tuple<T, int>;
    priority_queue<Tup, vector<Tup>, greater<Tup>> que;

    que.emplace(0, start);
    result[start] = 0;

    while (!que.empty()) {
      Tup p = que.top();
      que.pop();

      T t = get<0>(p);
      int v = get<1>(p);

      // queueに入れてから別の最短経路が見つかった場合、探索処理は不要
      if (result[v] != t) {
        continue;
      }

      // vの各辺に対しよりコストの低い経路があるかを確認
      for (auto& e : G[v]) {
        if (result[e.to] > result[v] + e.cost) {
          prev[e.to] = v;
          result[e.to] = result[v] + e.cost;
          que.emplace(result[v] + e.cost, e.to);
        }
      }
    }
  }

  // t: 目的地
  vector<int> get_path(const vector<int>& prev, int t) {
    vector<int> path;

    for (int v = t; v != -1; v = prev[v]) {
      path.push_back(v);
    }

    reverse(path.begin(), path.end());
    return path;
  }
};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  using T = tuple<ld, ld, ld>;
  vector<T> p;

  ld sx, sy, gx, gy;
  cin >> sx >> sy >> gx >> gy;
  p.emplace_back(sx, sy, 0);
  p.emplace_back(gx, gy, 0);

  ll n;
  cin >> n;

  rep(i, n) {
    ll x, y, r;
    cin >> x >> y >> r;
    p.emplace_back(x, y, r);
  }

  Dijkstra<ld> g(n + 2);
  rep(i, p.size()) {
    rep(j, i) {
      ld dx = get<0>(p[i]) - get<0>(p[j]);
      ld dy = get<1>(p[i]) - get<1>(p[j]);
      ld c = sqrt(dx * dx + dy * dy);
      c -= get<2>(p[i]) + get<2>(p[j]);
      chmax(c, (ld)0);

      g.add_edge(i, j, c);
      g.add_edge(j, i, c);
    }
  }

  vld res;
  g.solve(0, res);

  cout << res[1] << endl;

  return 0;
}


Measured memory_bytes: 43940
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;

const int N = 6000;
const int L = 4000;

int match(char c1, char c2){
  return (c1 == c2) || (c1 == '?') || (c2 == '?');
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a,b,c;
  cin >> a >> b >> c;
  int lena = a.size();
  int lenb = b.size();
  int lenc = c.size();
  vector<int> ab(N,0);
  vector<int> ac(N,0);
  vector<int> bc(N,0);


  //calc ab[]
  rep(i,lena) {
    rep(j,lenb) {
      if(!match(a[i], b[j])) {// b[j] in string a index : 
        ab[i - j + L] = 1;
      }
    }
  }

  rep(i,lena) {
    rep(j,lenc) {
      if(!match(a[i], c[j])) {// c[j] in string a index : 
        ac[i - j + L] = 1;
      }
    }
  }
  rep(i,lenb) {
    rep(j,lenc) {
      if(!match(b[i], c[j])) {// b[j] in string a index : 
        bc[i - j + L] = 1;
      }
    }
  }
  
  int ret = 3 * L;
  // string a range : [0,lena)
  for (int i = -4000 ; i <= 4000 ; i++ ){ // index of string b in a : i
    for (int j = -4000; j <= 4000; j++ ) { // index of string c in a : j
      if( !ab[i + 4000] && !ac[j+4000] && !bc[j-i+4000] ){// 
        int left = min(0,min(i,j));
        int right = max(lena,max(i+lenb,j+lenc)); // index range [left,right)
        ret = min(ret,right-left);
      }
    }
  }
  
  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 512
#include <iostream>

using namespace std;

typedef long long LL;

int main() {
	char a, f, b;
	char ans = 'A';
	while (cin >> a >> f >> b) {
		if(a == ans){
			ans = b;
		}
		else if (b == ans) {
			ans = a;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3036
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
const int N = 5e5 + 7;
int n, K;
int pos[N], du[N], ans[N], rans[N];
vector<int>G[N];
void Add(int a, int b) {
	++du[b];
	G[a].pb(b);
}
typedef pair<int, int> pii;
#define mp make_pair
#define Ls o << 1
#define Rs o << 1 | 1
int mx[N << 2];
void modify(int p, int l, int r, int o, int v) {
	if(l == r) {
		mx[o] = v;
		return;
	}int mid = l + r >> 1;
	if(p <= mid) modify(p, l, mid, Ls, v);
	else modify(p, mid + 1, r, Rs, v);
	mx[o] = max(mx[Ls], mx[Rs]);
}
int query(int L, int R, int l, int r, int o) {
	if(L > R) return 0;
	if(L <= l && r <= R) return mx[o];
	int mid = l + r >> 1;
	if(R <= mid) return query(L, R, l, mid, Ls);
	if(L > mid)  return query(L, R, mid + 1, r, Rs);
	return max(query(L, R, l, mid, Ls), query(L, R, mid + 1, r, Rs));
}
priority_queue<int>Q;
int main() {
#ifndef ONLINE_JUDGE
//	freopen("data.in", "r", stdin);
#endif
	n = gi(), K = gi() - 1;
	rep(i, 1, n) {
		pos[gi()] = i;
	}
	rep(i, 1, n) {
		int x = query(max(1, pos[i] - K), pos[i], 1, n, 1);
		if(x) Add(pos[i], pos[x]);
		x = query(pos[i], min(n, pos[i] + K), 1, n, 1);
		if(x) Add(pos[i], pos[x]);
		modify(pos[i], 1, n, 1, i);
	}
	rep(i, 1, n) if(!du[i]) Q.push(i);
	int now = n;
	while(!Q.empty()) {
		int u = Q.top();Q.pop();
		for(auto v:G[u])
		if(--du[v] == 0) Q.push(v);
		ans[now--] = u;
	}
	rep(i, 1, n) rans[ans[i]] = i;
	rep(i, 1, n) printf("%d\n", rans[i]);
	return 0;
}

Measured memory_bytes: 46464
use std::collections::BTreeMap;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let h: usize = sc.read();
    let mut cur: BTreeMap<usize, usize> = BTreeMap::new();
    cur.insert(h, 1);
    let mut attack = 0;
    while !cur.is_empty() {
        let mut next = BTreeMap::new();
        for (x, count) in cur.into_iter() {
            if x > 1 {
                *next.entry(x / 2).or_insert(0) += 2 * count;
            }
            attack += count;
        }
        cur = next;
    }
    println!("{}", attack);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

typedef long long ll;
typedef pair<int, int> ii;

const int MOD = 1e9 + 7;
ll n, k;

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

    cin >> n >> k;

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

    return 0;
}


Measured memory_bytes: 3648
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line;
        boolean first = true;

        while (!(line = br.readLine()).equals("0 0")) {
            if(!first)  System.out.println();
            String[] input = line.split(" ");
            int a = Integer.parseInt(input[0]);
            int b = Integer.parseInt(input[1]);
            StringBuilder sb = new StringBuilder();

            boolean isNA = true;

            for (int now = a; now <= b; now++) {
                if (now % 4 == 0) {
                    if(now % 100 == 0){
                        if(now % 400 == 0){
                            sb.append(now).append("\n");
                            if (isNA)   isNA = false;
                        }
                    }else{
                        sb.append(now).append("\n");
                        if (isNA)   isNA = false;
                    }
                }
            }

            if (isNA) {
                sb.append("NA").append("\n");
            }

            System.out.print(sb);
            first = false;
        }

    }
}


Measured memory_bytes: 24200
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    vector<vector<int>>grid(h,vector<int>(w));
    rep(i, h)
    {
        cin >> s[i];
    }
    rep(i,h){
        int tmp=0;
        rep(j,w){
            if(s[i][j]=='.'){
                tmp++;
            }else{
                tmp=0;
            }
            grid[i][j]+=tmp;
        }
    }
    rep(i,h){
        int tmp=0;
        rep(j,w){
            int ite=w-1-j;
            if(s[i][ite]=='.'){
                tmp++;
            }else{
                tmp=0;
            }
            grid[i][ite]+=tmp-1;
        }
    }
    rep(i,w){
        int tmp=0;
        rep(j,h){
            if(s[j][i]=='.'){
                tmp++;
            }else{
                tmp=0;
            }
            grid[j][i]+=tmp-1;
        }
    }
     rep(i,w){
        int tmp=0;
        rep(j,h){
            int ite=h-1-j;
            if(s[ite][i]=='.'){
                tmp++;
            }else{
                tmp=0;
            }
            grid[ite][i]+=tmp-1;
        }
    }
    int ans=0;
    rep(i,h)rep(j,w){
        ans=max(grid[i][j],ans);
      /*  cout<<grid[i][j];
        if(j==w-1){
            cout<<endl;
        }else{
            cout<<" ";
        }*/
    }
    cout<<max(ans,0)<<endl;
}


Measured memory_bytes: 20096
import java.util.*;
import java.util.Map.Entry;
 
 
 
public class Main{
	
	public int num;
	public int vol;
 
	
	//最大公約数・最小公倍数（セットで使う）
	public static long gcm(long a, long b) {
		long result = a;
		long k = 0;
		long n = b;
		do {
			k = result % n;
			result = n;
			n = k;
		} while(k != 0);
		return result;
	}
	
	public static long lcm(long a, long b) {
		long g;
		g = gcm(a, b);
		return a/g*b;
	}
	
	static long gcd (long a, long b) {
		long temp;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return b;
	}
	
	//等差数列
	static long tousasum(int n) {
		return (long)n*((long)n+1)/2;
	}
 
 
 
	//素数判定
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2) if(n%i==0){return false;}
		return true;
	}
 
 
	//倍数判定（10進数以外のときに有用）
	static boolean isMultiple (String s, int base, int m) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*base+Character.getNumericValue(s.charAt(i)))%m;
		}
		if (temp==0) {return true;}
		return false;
	}
 
 
	//階乗
	static long factorial (int i) {
		if (i==1) {return 1;}
		else {return i*factorial(i-1);}
	}
 
 
	//進数変換
	static String toNbase (String sm, int m, int n) {
		return Long.toString(Long.parseLong(sm,m),n);
	}
	
	public static final long gcd_n(long[] param) {
	    final int len = param.length;
	    long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
	    for (int i = 1; i < len - 1; i++) {
	        g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
	    }
	    return g;
	}
	
	public static long lcm_n(long[] numbers) {
		long l;
		l = numbers[0];
		for (int i = 1; i < numbers.length; i++) {
			l = lcm(l, numbers[i]);
		}
		return l;
	}
	
	
 public static void main(String[] args) {
	 Scanner sc=new Scanner(System.in);
	 int N=sc.nextInt();
	 long m1=0;
	 long m2=0;
	 Map<Long,Integer> map=new TreeMap<Long,Integer>(Comparator.reverseOrder());
	 for(int i=0;i<N;i++) {
		 long temp=sc.nextLong();
		 if(map.containsKey(temp)) {
			 map.put(temp,map.get(temp)+1);
		 }else {
			 map.put(temp,1);
		 }
		 
	 }
	 
	 for (Long nKey : map.keySet())
     {
		 if(map.get(nKey)>=4&&m1==0) {
			m1=nKey;
			m2=nKey;
			break;
		 }else if(map.get(nKey)>1) {
			 if(m1==0) {
				 m1=nKey;
			 }else if(m2==0) {
				 m2=nKey;
				 break;
			 }
		 }
         //System.out.println(nKey+" "+map.get(nKey));
     }
	 
	 long result=m1*m2;
	 
	 System.out.println(result);
	 
 }
	
 
 
}


Measured memory_bytes: 64520
#include <cstdio>
#include <algorithm>
using namespace std;
const int N=100005;
int k,n;
int h[N];
int ans;
int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	sort(h+1,h+n+1);
	ans=0x7fffffff;
	for (int i=1;i<=n-k+1;i++)
		if (h[i+k-1]-h[i]<ans)
			ans=h[i+k-1]-h[i];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> a(n), exist(100000, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i : a) exist[i]++;
  
  int max_sum = 0;
  for (int i = 1; i < 99999; i++) {
    int sum = exist[i-1] + exist[i] + exist[i+1];
    max_sum = max(max_sum, sum);
  }
  
  cout << max_sum << endl;
}

Measured memory_bytes: 1024
/**
 * Title: D - Maze Master
 * Url: https://atcoder.jp/contests/abc151/tasks/abc151_d
 * 
 * <解法ポイント>
 * 
 * ・全探索
 * start, goal を全列挙 O((HW)^2) <= 10^4
 * 
 */
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<numeric>
#include<functional>
#include<sstream>
#include<iomanip>
#include<queue>

using namespace std;

#define ll long long
#define INF 10000000000

int calc_dst(pair<int,int> start, vector<vector<int>> meiro) {
    queue<pair<int, pair<int,int>>> que;
    vector<pair<int, int>> visited;
    que.push(pair<int, pair<int,int>>(0, start));
    visited.push_back(start);
    int longest_dst = 0;
    while(!que.empty()) {
        pair<int, pair<int,int>> ptr = que.front();
        que.pop();
        int dst = ptr.first;
        int hi = ptr.second.first;
        int wj = ptr.second.second;
        longest_dst = max(longest_dst, dst);
        if(meiro[hi-1][wj]==0) {
            auto next_point = make_pair(hi-1, wj);
            auto next = make_pair(dst+1, next_point);
            if(count(visited.begin(), visited.end(), next_point)==0) {
                visited.push_back(next_point);
                que.push(make_pair(dst+1, next_point));
            }
        }
        if(meiro[hi+1][wj]==0) {
            auto next_point = make_pair(hi+1, wj);
            auto next = make_pair(dst+1, next_point);
            if(count(visited.begin(), visited.end(), next_point)==0) {
                visited.push_back(next_point);
                que.push(make_pair(dst+1, next_point));
            }
        }
        if(meiro[hi][wj-1]==0) {
            auto next_point = make_pair(hi, wj-1);
            auto next = make_pair(dst+1, next_point);
            if(count(visited.begin(), visited.end(), next_point)==0) {
                visited.push_back(next_point);
                que.push(make_pair(dst+1, next_point));
            }
        }
        if(meiro[hi][wj+1]==0) {
            auto next_point = make_pair(hi, wj+1);
            auto next = make_pair(dst+1, next_point);
            if(count(visited.begin(), visited.end(), next_point)==0) {
                visited.push_back(next_point);
                que.push(make_pair(dst+1, next_point));
            }
        }
    }
    return longest_dst;
}

int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> meiro(h+2, vector<int>(w+2, 1));
    for(int i=1; i<=h; i++) {
        for(int j=1; j<=w; j++) {
            char sij; cin >> sij;
            if(sij=='.') meiro[i][j] = 0;
        }
    }
    int ans = 0;
    for(int i=1; i<=h; i++) {
        for(int j=1; j<=w; j++) {
            if(meiro[i][j]==0) {
                ans = max(ans, calc_dst(make_pair(i,j), meiro));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Theater
            int N = int.Parse(Console.ReadLine());
            int seated = 0;

            for(int i = 0; i < N; i++)
            {
                var line = ReadLine();
                int l = line[0];
                int r = line[1];

                seated += r - l + 1;
            }

            Console.WriteLine(seated);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

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

typedef long long int  lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#define pb push_back
#define popb pop_back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define forz(i,n) for( int i=0;i<n;i++)
#define forl(i, n) for(int i = 1; i<= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)

using namespace std;


int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w" , stdout);
// #endif
	lli x, y, z, a;
	cin >> x >> y >> z;
	a = x;
	x = y;
	y = a;
	a = x;
	x = z; z = a;
	cout << x << " " << y << " " << z << endl;

	return 0;
}




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


using namespace std;


using ll = long long;


mt19937 mt(736);

template<class T>
T &remin(T &x, const T &y)
{
	return x = min(x, y);
}

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


const int bnd = 300;


ll Dijkstra(unordered_map<ll, ll> &dp, const ll n, const int a, const int b, const int c, const int d)
{
	if (n >= bnd)
		return numeric_limits<ll>::max() / 100;
	if (n == 0)
		return 0;

	if (!dp.count(n))
	{
		minheap<pair<ll, ll>> pq;
		pq.emplace(0, 0);

		while (!pq.empty())
		{
			ll val, num;
			tie(val, num) = pq.top();
			pq.pop();

			if (num < bnd && !dp.count(num))
			{
				dp[num] = val;

				pq.emplace(val + a, num * 2);
				pq.emplace(val + b, num * 3);
				pq.emplace(val + c, num * 5);
				pq.emplace(val + d, num + 1);
				if (num % 2 == 0)
					pq.emplace(val + a, num / 2);
				if (num % 3 == 0)
					pq.emplace(val + b, num / 3);
				if (num % 5 == 0)
					pq.emplace(val + c, num / 5);
				if (num > 0)
					pq.emplace(val + d, num - 1);
			}
		}
	}

	return dp.at(n);
}


ll foo(unordered_map<ll, ll> &dp, const ll n, const int a, const int b, const int c, const int d)
{
	if (n < 300)
		return Dijkstra(dp, n, a, b, c, d);

	if (!dp.count(n))
	{
		ll ans = min(numeric_limits<ll>::max() / d, n) * d;

		for (ll i = max(0ll, n - 5); i <= n + 5; i++)
		{
			if (i % 2 == 0)
				remin(ans, foo(dp, i / 2, a, b, c, d) + d * abs(i - n) + a);
			if (i % 3 == 0)
				remin(ans, foo(dp, i / 3, a, b, c, d) + d * abs(i - n) + b);
			if (i % 5 == 0)
				remin(ans, foo(dp, i / 5, a, b, c, d) + d * abs(i - n) + c);
		}

		dp[n] = ans;
	}

	return dp.at(n);
}


void solve_test(istream &cin = std::cin, ostream &cout = std::cout)
{
	ll n;
	int a, b, c, d;

	cin >> n >> a >> b >> c >> d;

	unordered_map<ll, ll> dp;

	cout << foo(dp, n, a, b, c, d) << endl;
}


void solve(istream &cin = std::cin, ostream &cout = std::cout)
{
	int t;

	cin >> t;

	for (int i = 0; i < t; i++)
		solve_test(cin, cout);
}


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

	cout << fixed;

#ifdef LOCAL
	auto st = clock();

	ifstream fin("../input.txt");

	solve(fin);

	cout << "clock: " << setprecision(4) << (clock() - st) / (double) CLOCKS_PER_SEC << endl;
#else
	solve();
#endif

	return 0;
}


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

#define int long long

using namespace std;

int a[100001];
int all, kol;

 main () {   
 	int n;
 	cin >> n;
 	for (int i = 1;i <= n;i ++) {
 		cin >> a[i];
 	}
 	sort (a + 1, a + n + 1);
 	for (int i = 1;i <= n;i ++) {
		all += a[i];		
		if (2 * all < a[i + 1]) kol = i;
 	}
 	cout << n - kol;
    return 0;           		
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    for(int i=0; i<n; i=i+2){
        if (s[i] != 'h' or s[i+1] != 'i'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    string S;
    cin >> S;
    vector<ll> R(N + 1, 0), G(N + 1, 0), B(N + 1, 0);
    rep(i, N) {
        if (S[i] == 'R') {
            R[i + 1] += 1;
        } else if (S[i] == 'G') {
            G[i + 1] += 1;
        } else {
            B[i + 1] += 1;
        }
        R[i + 1] += R[i];
        G[i + 1] += G[i];
        B[i + 1] += B[i];
    }

    ll ans = 0;
    rep(i, N) {
        char f = S[i];
        rep2(j, i + 1, N) {
            char s = S[j];
            if (f == s) continue;
            ll c = 0;
            if (f == 'R' && s == 'G') {
                c += B[N] - B[j + 1];
                if (2 * j - i < N && S[2 * j - i] == 'B') c--;
            }
            if (f == 'R' && s == 'B') {
                c += G[N] - G[j + 1];
                if (2 * j - i < N && S[2 * j - i] == 'G') c--;
            }
            if (f == 'G' && s == 'R') {
                c += B[N] - B[j + 1];
                if (2 * j - i < N && S[2 * j - i] == 'B') c--;
            }
            if (f == 'G' && s == 'B') {
                c += R[N] - R[j + 1];
                if (2 * j - i < N && S[2 * j - i] == 'R') c--;
            }
            if (f == 'B' && s == 'G') {
                c += R[N] - R[j + 1];
                if (2 * j - i < N && S[2 * j - i] == 'R') c--;
            }
            if (f == 'B' && s == 'R') {
                c += G[N] - G[j + 1];
                if (2 * j - i < N && S[2 * j - i] == 'G') c--;
            }
            ans += c;
        }
    }
    cout << ans << '\n';
}

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


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

int main() {
  double a, b, x, h, w, ans, pai, rad;
  cin >> a >> b >> x;
  pai = acos(-1);
  
  if((a*b/2)<=(x/a)) {
    h = (2/a)*((a*b)-(x/a));
    rad = atan2(h, a);
  }else {
    w = (2*x)/(a*b);
    rad = atan2(b, w);
  }
  ans = rad * 180 / pai;
  printf("%.10f\n", ans);
  
  return 0;
}
    


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int H[2];
  int M[2];
  int K;
  cin >> H[0] >> M[0] >> H[1] >> M[1] >> K;
  int l = (H[0] * 60) + M[0];
  int r = (H[1] * 60) + M[1];
  cout << r - l - K << endl;
  return 0;
}


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

int main(){
    int a,b;
	char op;
    while(1){
        cin>>a>>op>>b;
        if(op=='?')break;
        switch(op){
        case '+':
                cout<<a+b<<endl;
                break;
        case '-':
            cout<<a-b<<endl;
            break;
        case '*':
            cout<<a*b<<endl;
            break;
        case '/':
            cout<<a/b<<endl;
            break;
           }
     }
    return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// string p=s.substr(0,len);
// string q=s.insert(0,str);
// sort(arr, arr+n, greater<int>());
// cout<<fixed<<setprecision(9)<<pi<<endl
// const  double pi = acos(-1.0);
// sort(v.rbegin(),v.rend());
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
	
	string s;
	cin>>s;

	/*
	string p = "";	// Not efficient no use of extra var creation
	for(int i=0;i<s.length();i++)
	{
		p = p+'x';
	}	
	cout<<p<<endl;
	*/	


	// Efficient manner
	for(int i=0;i<s.size;i++)
	{
		s[i]='x';
	}

	cout<<s<<endl;
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define mp make_pair
#define INF (1LL<<60)
typedef long long Int;

struct node { int x, t, p; };
bool operator<(const node& l, const node& r) {
    return l.t!=r.t ? l.t<r.t : l.x!=r.x ? l.x<r.x : l.p<r.p;
}

int N, V, XL, XR;
node X[4000];

inline bool connect(int i, int j) {
    return abs(X[j].x-X[i].x)<=(long long)V*abs(X[j].t-X[i].t);
}

pair<int, int> pre[6400];
int vis[6400];
Int h[6400];
vector<int> v[6400];
vector<Int> c[6400];
set<pair<Int, int> >::iterator z[6400];
bool has[6400];


inline void add_edge(int _u, int _v, Int _c) {
    v[_u].push_back(_v);
    c[_u].push_back(_c);
}

int main() {
    scanf("%d%d%d%d", &N, &V, &XL, &XR);
    X[0].x = XL;
    X[1].x = XR;
    rep(i, N) scanf("%d%d%d", &X[i+2].x, &X[i+2].t, &X[i+2].p);
    N += 2;
    sort(X, X+N);

    rep(i, 2+N*2) h[i] = INF;
    h[0] = 0;
    rep(i, 2) add_edge(0, 2+i*2, 0), h[2+i*2] = 0, pre[2+i*2] = mp(0, i);
    rep(i, N) {
        const int f = 2+2*i+1;
        add_edge(f-1, f, -X[i].p), h[f] = h[f-1]-X[i].p, pre[f] = mp(f-1, 0);
        add_edge(f, 1, 0);
        if(h[1]>h[f]) h[1] = h[f], pre[1] = mp(f, 0);
        for(int j=i+1; j<N; j++) if(connect(i, j)) {
            const int t = 2+2*j;
            add_edge(f, t, 0);
            if(h[t]>h[f]) h[t] = h[f], pre[t] = mp(f, v[f].size()-1);
        }
    }

    int cur = 1;
    while(cur!=0) {
        const int f = pre[cur].first;
        const int k = pre[cur].second;
        add_edge(cur, f, -c[f][k]);
        c[f][k] = INF;
        cur = f;
    }

    set<pair<Int, int> > q;
    q.insert(mp(0, 0));
    while(!q.empty()) {
        const pair<Int, int> vv(*q.begin());
        q.erase(q.begin());
        const int cc = vv.first;
        const int ix = vv.second;
        if(vis[ix]) continue;
        vis[ix] = 1;
        if(ix==1) {
            cout << -(h[1]*2+cc) << endl;
            break;
        }
        rep(i, v[ix].size()) if(!vis[v[ix][i]]) {
            const Int nc = cc + c[ix][i] + h[ix] - h[v[ix][i]];
            if(has[v[ix][i]]) {
                if(z[v[ix][i]]->first <= nc) continue;
                q.erase(z[v[ix][i]]);
            }
            has[v[ix][i]] = true;
            z[v[ix][i]] = q.insert(mp(nc, v[ix][i])).first;
        }
    }
    return 0;
}

Measured memory_bytes: 67000
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll N;
  cin >> N;
  ld T, A;
  cin >> T >> A;
  vll H(N);

  ll ans = 0;
  ld mini_t = INF;
  rep(i, N) {
    ll h;
    cin >> h;

    ld sa = abs((ld)T - (ld)0.006 * (ld)h - A);
    if (sa < mini_t) {
      mini_t = sa;
      ans = i;
    }
  }
  COUT(ans + 1);

  return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
canvas = [[i for i in input()]]
for i in range(H - 1):
    tmp = [i for i in input()]
    canvas.append(tmp)
direction = [[-1, 0], [0, -1], [0, 1], [1, 0]]
for i in range(H):
    for j in range(W):
        if canvas[i][j] == "#":
            canDraw = False
            for k in direction:
                if (i - k[0] >= 0 and i - k[0] < H) and (j - k[1] >= 0 and j - k[1] < W):
                    if canvas[i - k[0]][j - k[1]] == "#":
                        canDraw = True
                        break
            if not canDraw:
                print("No")
                exit()
print("Yes")


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
int Min(int a, int b, int c) {
	if (a <= b) { return std::min(a, c); }
	else return std::min(b, c);
}
int main(void) {
	string str, str2; cin >> str >> str2;
	if (str.at(0) == str2.at(2) && str.at(1) == str2.at(1) && str.at(2) == str2.at(0))
		cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
buz = [int(x) for x in list(input())]
bit = 8
for i in range(bit):
    buf = buz[0]
    ans = str(buz[0])
    for j in range(3):
        if i & 1 << j:
            buf += buz[1+j]
            ans += "+" + str(buz[1+j])
        else:
            buf -= buz[1+j]
            ans += "-" + str(buz[1 + j])
    if buf == 7:
        print(ans + "=7")
        break

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-


def main():
    n, k, s = map(int, input().split())
    a = [0 for _ in range(n)]

    for i in range(n):
        if i < k:
            a[i] = s
        else:
            if s == 10 ** 9:
                a[i] = s - 1
            else:
                a[i] = s + 1

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 15128
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    string s;
    cin >> s;
    int N = s.size();

    int n = 0;
    rep (i, N - 1)
    {
        n<<= 1;
        n |= 1;
    }

    s64 ans = 0;
    s64 t;
    for (; n >= 0; --n)
    {
        int l = 0;
        rep (r, N - 1)
        {
            if ((n >> r) & 1)
            {
                t = 0;
                for (; l <= r; ++l)
                {
                    t = t * 10 + (int)(s[l] - '0');
                }
                ans += t;
            }
        }
        t = 0;
        for (; l < N; ++l)
        {
            t = t * 10 + (int)(s[l] - '0');
        }
        ans += t;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;

public class Main {


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

        String s = sc.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int d = Integer.parseInt(s.split(" ")[1]);

        int[][] x = new int[n][d];
        for (int i = 0; i < n; i++) {
            s = sc.nextLine();
            String[] temp = s.split(" ");
            for (int j = 0; j < d; j++) {
                x[i][j] = Integer.parseInt(temp[j]);
            }
        }

        int ans = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {

                double dis = 0;
                for (int k = 0; k < d; k++) {
                    dis += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
                }

                if (Math.sqrt(dis) == Math.ceil(Math.sqrt(dis))) {
                    ans++;
                }
            }
        }

        System.out.println(ans);


        return;
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define PI       3.1415926535897932384626433832795028841971
#define INF      100000000
#define EPS      1e-10
#define MOD      1000000007
using namespace std;
typedef long long ll;

ll n;

int main(){
    cin >> n;
    for(ll i = 1; i <= n; i++){
        if(i*(i+1) >= n*2){
            ll x = n;
           for(ll j = i; j >= 1; j--){
               if(n-j >= 0){
                   cout << j << endl;
                   n -= j;
               }
           } 
           return 0;
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	//maerd,esare,remaerd,resare
	string s;cin >> s;
	int n = s.size();
	reverse(s.begin(),s.end());
	for(int i = 0;i < n;){
		if(s.substr(i,5) == "maerd"){
			i += 5;
		}
		else if(s.substr(i,5) == "esare"){
			i += 5;
		}
		else if(s.substr(i,6) == "resare"){
			i += 6;
		}
		
		else if(s.substr(i,7) == "remaerd"){
			i += 7;
		}
		else {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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


int main()
{
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    const ll MOD = 998244353;
    vector<vector<ll>> dp(c+1, vector<ll>(d+1, 0));
    for(i = a;i <= c;++i){
        for(j = b;j <= d;++j){
            if(i == a && j == b) dp.at(a).at(b) = 1;
            else if(i == a) dp.at(i).at(j) = dp.at(i).at(j-1)*i%MOD;
            else if(j == b) dp.at(i).at(j) = dp.at(i-1).at(j)*j%MOD;
            else{
                dp.at(i).at(j) = dp.at(i-1).at(j)*j + dp.at(i).at(j-1)*i;
                dp.at(i).at(j) %= MOD;
                dp.at(i).at(j) += MOD - (dp.at(i-1).at(j-1)*(i-1)%MOD*(j-1)%MOD);
                dp.at(i).at(j) %= MOD;
            }
        }
    }
    cout << dp.at(c).at(d) << endl;
    return 0;
}

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

int main() {
	ll a,b,n;
	cin >> a >> b >> n;
	ll ans;
	if (n>=b) ans = a*(b-1)/b;
	else ans = a*n/b;
	cout << ans << endl;
	return 0;
}


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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define rep1(i,n) rep(i,1,n+1)
#define repR(i,s,n) for(ll i = (n-1); i >= (s); i--)
#define repR0(i,n) repR(i,0,n)
#define repR1(i,n) repR(i,1,n+1)

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;
#define fcout cout << fixed << setprecision(18)

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int a[100];
int cells[100][100]; // r * c

int main() {
  int N, M, R;
  cin >> N >> M >> R;

  vector<ll> r(R);
  rep0(i, R) {
    cin >> r[i];
    r[i]--;
  }

  ll INF = 1e9;
  vector<vector<ll>> C(N, vector<ll>(N, INF));
  vector<vector<ll>> D(N, vector<ll>(N, INF));

  rep0(i, M) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    C[a][b] = c;
    C[b][a] = c;
  }
  rep0(k, N) {
    rep0(i, N) {
      rep0(j, N) {
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }

  ll ans = 1e9;
  sort(r.begin(), r.end());
  do {
    ll temp = 0;
    rep(i, 1, R) {
      temp += C[r[i - 1]][r[i]];
    }
    ans = min(ans, temp);
  } while (next_permutation(r.begin(), r.end()));

  cout << ans << BR;
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
 int main() {
 int N;
 cin>>N;
 vector<long long> test(N);
  bool zero=false;
 
  for(int i=0;i<N;i++){
  cin>>test.at(i);
    if(test.at(i)==0){
    zero=true;
    }
  }
  if(zero){
  cout<<0<<endl;
  }else{
   long long sum=1;
   bool dekakunai=true;
   for(int i=0;i<N;i++){
    
   if(test.at(i)<=1000000000000000000/sum){
   sum=sum*test.at(i);
   }else{
     dekakunai=false;
     cout<<-1<<endl;
     
     break;
     }
    }
    if(dekakunai){
      cout<<sum<<endl;
    }
 }

}

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

template <typename T>
class LazySegmentTree {
	const int n;
	const T id;
	vector<T> data, data2;
	int size(int n) {
		int res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	T sub(int l, int r, int node, int lb, int ub) {
		if (ub <= l || r <= lb) return id;
		if (l <= lb && ub <= r) {
			return data[node] + data2[node] * (ub - lb);
		}
		return data2[node] * (min(r, ub) - max(l, lb))
			+ sub(l, r, node * 2, lb, (lb + ub) / 2)
			+ sub(l, r, node * 2 + 1, (lb + ub) / 2, ub);
	}
	void suc(int l, int r, int node, int lb, int ub, T val) {
		if (ub <= l || r <= lb) return;
		if (l <= lb && ub <= r) {
			data2[node] += val;
			return;
		}
		data[node] += val * (min(r, ub) - max(l, lb));
		suc(l, r, node * 2, lb, (lb + ub) / 2, val);
		suc(l, r, node * 2 + 1, (lb + ub) / 2, ub, val);
	}
public:
	LazySegmentTree(int n_) :
		n(size(n_)), id(0), data(n * 2, id), data2(n * 2, id) {}
	void add(int l, int r, T val) {
		suc(l, r + 1, 1, 0, n, val);
	}
	T getSum(int l, int r) {
		return sub(l, r + 1, 1, 0, n);
	}
};

int main()
{
	ll n, m, res = 0;
	cin >> n >> m;
	vector<int> a(n);
	for(int i = 0;i < n;i++){
		cin >> a[i]; a[i]--;
	}
	LazySegmentTree<ll> lst(m);
	for(int i = 1;i < n;i++){
		res += (a[i] + m - a[i - 1]) % m;
		if(a[i] > a[i - 1]){
			lst.add(a[i - 1] + 2, a[i], 1);
			lst.add(a[i] + 1, a[i] + 1, -(a[i] - a[i - 1] - 1));
		}
		else if(a[i] < a[i - 1]){
			if(a[i - 1] + 2 <= m - 1){
				lst.add(a[i - 1] + 2, m - 1, 1);
				lst.add(0, 0, m - 1 - a[i - 1] - 1);
			}
			lst.add(max(0ll, a[i - 1] + 2 - m), a[i], 1);
			lst.add(a[i] + 1, a[i] + 1, -(a[i] + m - a[i - 1] - 1));
		}
	}
	ll ma = 0;
	for(int i = 0;i < m;i++){
		ma = max(ma, lst.getSum(0, i));
	}
	cout << res - ma << endl;
	return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define int long long
int a[26];
using namespace std;
signed main(){
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++){
        a[s[i]-97]++;
    }
    int ans=1;
    for(int i=0;i<26;i++){
        ans=ans*(a[i]+1);
        ans=ans%1000000007;
    }
    cout<<ans-1<<endl;
}

Measured memory_bytes: 512
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

//AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC(*'ω'*)AC
int main(){
    int n;cin>>n;
    vector<lint> vec(n);
    for(int i=0;i<n;i++)cin>>vec[i];
    lint ans=0;
    for(int i=1;i<n;i++){
        if(vec[i-1]>vec[i]){
            ans+=vec[i-1]-vec[i];
            vec[i]=vec[i-1];
        }
    }
    cout<<ans<<endl;
}


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

int main() {
  // AK = C(mod B)
  int a, b, c; cin >> a >> b >> c;
  bool ok = false;
  for (int i = 0; i <= b; i++) if (a * i % b == c) ok = true;
  cout << (ok ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define NIL -1
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
/*long int frog1(long int dp[],int h[],long int i)
{
  
  if(i==1)
    dp[i]=abs(h[i+1]-h[i]);
  else
    
  
    return dp[i-1];
}*/
int main()
{
  fio;
  long int n;
  int k;
  cin>>n;
  cin>>k;
  int h[n+1];
  long int dp[n];
  vector<int> v;
  dp[0]=0;
   for(int i=1;i<n;++i)
    dp[i]=NIL;
  for(int i=1;i<=n;++i)
  cin>>h[i];
    for(int i=1;i<n;++i)
    {
      long int min=INT_MAX ;
      for(int j=0;j<k;j++)
      {
        if(i>j and min>(abs(h[i+1]-h[i-j])+dp[i-j-1]))
          min=(abs(h[i+1]-h[i-j])+dp[i-j-1]);
        dp[i]=min;
      }
    }
  //long int k=frog1(dp,h,n);
/*  dp[1]=abs(h[2]-h[1]);
  for(int i=2;i<n;++i)
    dp[i]=min(abs(h[i+1]-h[i])+dp[i-1],abs(h[i+1]-h[i-1])+dp[i-2]);*/
  //for(int i=0;i<n;++i)
  cout<<dp[n-1]<<'\n';
  return 0;
}

Measured memory_bytes: 1408