akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int cnt[1000010];

signed main() {
	cin.tie(nullptr);
	cout.tie(nullptr);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int n;
	cin >> n;
	int a[n];
	int maxval = 0, allgcd = 0;
	rep(i, n) {
		cin >> a[i];
		allgcd = gcd(allgcd, a[i]);
		cnt[a[i]]++;
		chmax(maxval, a[i]);
	}

	bool pairwise = true;
	for(int i = 2; i <= maxval+10; i++) {
		int cursum = 0;
		for(int j = i; j <= maxval+10; j+=i) {
			cursum += cnt[j];
		}
		if(cursum > 1) pairwise = false;
	}
	
	if(allgcd > 1) cout << "not coprime" << endl;
	else if(!pairwise) cout << "setwise coprime" << endl;
	else cout << "pairwise coprime" << endl;
	//cout << allgcd << endl;
	return 0;
}

Measured memory_bytes: 19140
from collections import defaultdict
from itertools import product
 
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
 
C = [[int(s[i]) for s in S] for i in range(W)]#列を一括りにする
 
total = sum(sum(c) for c in C)#すべての値の合計を算出
 
if total <= K:
  answer = 0
else:
  answer = H * W
  for X in product([False, True], repeat=H-1):#Hは行数
    #あるXについて一回目のfor文が回る
    ans = sum(X)#Trueの数を換算
    if ans > answer:
      continue
    M = [[0]]
    for i, x in enumerate(X):
      if x:#Trueなら実行
        M.append([])#Trueの数の配列が作成される
      M[-1].append(i+1)#一番最後にその番目をappendする
    D = [0] * len(M)#初期値を設定
    for c in C:
      for k, m in enumerate(M):
        D[k] += sum(c[i] for i in m)#k番目の要素に足していく
        #Dにどんどん代入することによってどの列まで足すことができるか算出することができる
      if any(d > K for d in D):#一つでもKを超えていたら
        ans += 1
        if ans > answer:
          break
        D = [sum(c[i] for i in m) for m in M]#Dの更新(1番最初のDに戻る)
        if any(d > K for d in D):#一つでもKを超えていたら
          ans = answer + 1#ansの更新
          break
    answer = min(answer, ans)

print(answer)

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

int main(){
  int N,M,C; cin >> N >> M >> C;
  
  int B[20];
  for(int i=0; i<M; i++) cin >> B[i];
  
  int answer=0;
  for(int i=0; i<N; i++){
    int result=C;
    for(int j=0; j<M; j++){
      int A; cin >> A;
      result+=A*B[j];
    }
    if(result>0) answer++;
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int d, d1, d10, m, D, M, ret;

int main() {
        scanf("%d %d", &M, &D);
        ret = 0;
        for (m = 1; m <= M; m++) {
                for (d = 1; d <= D; d++) {
                        d1 = d % 10;
                        d10 = d / 10;
                        if (d1 >= 2 && d10 >= 2 && m == d1 * d10)
                                ret++;
                }
        }
        printf("%d\n", ret);
        return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
pi D[MAX_N];

pl get(pl pi, pl pj) {
	if(pi < pj) swap(pi, pj);
	ll p = pi.fst - pj.fst, q = pi.sec - pj.sec;
	return pl(p, q);
}

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> D[i].fst >> D[i].sec;
	int res = N;
	rep(i, 0, N) {
		rep(j, i + 1, N) {
			pl d = get(D[i], D[j]);
			int tmp = N;
			rep(k, 0, N) {
				rep(l, k + 1, N) {
					pl e = get(D[k], D[l]);
					if(d == e) tmp--;
				}
			}
			MIN(res, tmp);
		}
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
n = int(input())
dat1 = list(map(int, input().split()))
dat2 = list(map(int, input().split()))
s1 = sum(dat1)
s2 = sum(dat2)
dp1 = [0]*200
dp2 = [0]*200
for i in range(n):
    dp1[i+1] = dp1[i] + dat1[i]
    dp2[i+1] = max(dp1[i+1] + dat2[i], dp2[i] + dat2[i])

print(dp2[n])


Measured memory_bytes: 38256
// Problem : B - Strings with the Same Length
// Contest : AtCoder Beginner Contest 148
// URL : https://atcoder.jp/contests/abc148/tasks/abc148_b
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include <bits/stdc++.h>

using namespace std;



int main() {
	ios_base :: sync_with_stdio(0); cin.tie(NULL);
	
	int N;
	string S, T;
	
	cin >> N >> S >> T;
	
	for(int i = 0; i < N; ++i) {
		cout << S[i] << T[i];
	}
	
	cout <<'\n';
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((ll)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

int main() {
  int M1, D1;
  cin >> M1 >> D1;
  int M2, D2;
  cin >> M2 >> D2;

  int j = 0;
  rep(i, 1000000000) {
    j++;
  }

  if (M1 == M2) {
    if (D1 + 1 == D2)
      cout << 0 << endl;
    else
      cout << 1 << endl;
  } else {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>

using namespace std;

int main() {

    int H, W;
    stringstream input;
    string out;

    while(1) {
        int A, B;
        cin >> A >> B;
        if (A == 0 && B == 0)
            break;
        input << A << " " << B << endl;
    }

    while(!input.eof()) {
        input >> H >> W;
        if (H == 0 && W == 0)
            break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                int number = i + j;
                if (number % 2 == 0) {
                    out += "#";
                    continue;
                }
                out += ".";
            }
            out += "\n";
        }
        cout << out << "\n";
        out = "";
        H = 0;
        W = 0;
    }
    return 0;
}

Measured memory_bytes: 3232
N,K,C = map(int,input().split())
S = input()

L = [0 for _ in range(K)]
R = [0 for _ in range(K)]
c = 0
i = 0
while(c < K):
  if S[i] == 'o':
    L[c] = i
    c += 1
    i += C+1
  else:
    i += 1
i = N-1
c = K-1
while(c >= 0):
  if S[i] == 'o':
    R[c] = i
    c -= 1
    i -= C+1
  else:
    i -= 1
#print(L)
#print(R)

ans = []
for i in range(K):
  if L[i] == R[i]:
    ans.append(L[i])
for a in ans:
  print(a+1)


Measured memory_bytes: 60408
use std::collections::{BTreeMap, BTreeSet};

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let l: u64 = sc.read();
    let mut trie = Trie {
        nodes: vec![[0; 2]],
    };
    for _ in 0..n {
        let s: Vec<usize> = sc
            .chars()
            .into_iter()
            .map(|c| c as usize - '0' as usize)
            .collect();
        trie.add(&s, 0, 0);
    }

    let mut results = vec![];
    trie.traverse(0, &mut results, l);
    println!(
        "{}",
        if results
            .into_iter()
            .map(|h| 1 << h.trailing_zeros())
            .fold(0, |xor, x| xor ^ x)
            == 0
        {
            "Bob"
        } else {
            "Alice"
        }
    );
}

struct Trie {
    nodes: Vec<[usize; 2]>,
}

impl Trie {
    fn add(&mut self, s: &[usize], pos: usize, cur: usize) {
        if pos == s.len() {
            return;
        }
        if self.nodes[cur][s[pos]] == 0 {
            self.nodes[cur][s[pos]] = self.nodes.len();
            self.nodes.push([0; 2]);
        }
        let cur = self.nodes[cur][s[pos]];
        self.add(s, pos + 1, cur);
    }

    fn traverse(&self, cur: usize, results: &mut Vec<u64>, height: u64) {
        let (a, b) = (self.nodes[cur][0], self.nodes[cur][1]);
        if a == 0 && b == 0 {
            return;
        }
        if a == 0 || b == 0 {
            results.push(height);
        }
        if a != 0 {
            self.traverse(a, results, height - 1);
        }
        if b != 0 {
            self.traverse(b, results, height - 1);
        }
    }
}

fn grundy(l: usize, map: &mut BTreeMap<usize, usize>) -> usize {
    match map.get(&l) {
        Some(&x) => x,
        None => {
            let mut set = BTreeSet::new();
            for i in 1..(l + 1) {
                let mut g = 0;
                for j in 1..i {
                    g ^= grundy(l - j, map);
                }
                set.insert(g);
            }
            let g = (0..).find(|x| !set.contains(x)).unwrap();
            map.insert(l, g);
            g
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .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: 17788
#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;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string sa, sb, sc;
    cin >> sa >> sb >> sc;

    int ai=0, bi=0, ci=0;
    char deban = 'a';

    rep(i, 305){
        if(deban == 'a'){
            deban = sa[ai];
            if(ai==sa.size()){
                cout << "A" << endl;
                return 0;
            }
            ai++;
        }else if(deban == 'b'){
            deban = sb[bi];
            if(bi==sb.size()){
                cout << "B" << endl;
                return 0;
            }
            bi++;
        }else{
            deban = sc[ci];
            if(ci==sc.size()){
                cout << "C" << endl;
                return 0;
            }
            ci++;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>
 
  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  // typedef long double lld;
//   typedef string str;
//   typedef unsigned long long ull;
//   ll INF = INT_MAX;
  // ll mod = 998244353;
  // lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;
  



 






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

   int n;
   cin>>n;
   n%=10;
   if (n==3){
    cout<<"bon\n";
   }else if (n==0 || n==1 || n==6 || n==8){
    cout<<"pon\n";
   }else{
    cout<<"hon\n";
   }
    
  

}
  

Measured memory_bytes: 3124
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int a, b; cin>>a>>b;
    
    cout << 6 - a - b << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

string a,b,c;

int main(){ 

cin.tie(0);
ios::sync_with_stdio(false);

cin>>a>>b>>c;

string A=a.substr(0,1);
string B=b.substr(0,1);
string C=c.substr(0,1);
string ans=A+B+C;


cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int n,x,s;
	while(cin >> n >> x, n+x)
	{
		s=0;
		for(int i=1;i<n-1;++i)
			for(int j=i+1; j<n;++j)
			{
				int k = x - i- j;
				if(k>=1 && k<=n && k > i && k > j) ++s;
			}
		cout << s << endl;
	}
	return 0;
}

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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORD(i, m, n) for (int i = m; i >= n; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 0; i <= n; ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

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

	int n;
	cin>>n;
	double k=0;
	REP(i,n){
		if(i%2==0)k+=1;
	}
	printf("%lf",k/n);

	return 0;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

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

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ((ll)(x).size())

int main() {
  string S, T;
  cin >> S >> T;
  ll tmp, result = 1001;
  REP(i, SIZE(S)-SIZE(T)+1) {
    tmp = 0;
    REP(j, SIZE(T)) {
      if (S[i+j] != T[j]) tmp++;
    }
    if (tmp < result) result = tmp;
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define rgt register
#define rint rgt int
#define LL long long
#define rll rgt LL
#define inf 0x7f7f7f7f
using namespace std;
template<class K>inline bool cmax(K&a,const K&b){return (a<b)?a=b,1:0;}
template<class K>inline bool cmin(K&a,const K&b){return (a>b)?a=b,1:0;}
inline int read() {
	rint s=0;
	rgt char c=getchar();
	while(!isdigit(c)) c=getchar();
	while(isdigit(c)) s=(s<<1)+(s<<3)+c-'0',c=getchar();
	return s;
}
int n;
int main()
{
	rint i,j;
	n=read();
	for(i=1;i<=9;i++) if(n%i==0&&n/i<=9) {printf("Yes");return 0;}
	printf("No");
	return 0;
}

Measured memory_bytes: 256
using namespace std;
#include <bits/stdc++.h>
#define FASTIO                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);
#define ll long long
#define debug(x) cout << #x << " = " << x << endl
int n;
set<int> elements;
int fre[1000001];
int arr[1000001];
bool check(int val)
{
  if (val == 1)
  {
    if (fre[1] > 1)
      return false;
    else
      return true;
  }
  if(fre[1]>0)
  return false;
  for (int i = 2; i <= sqrt(val); i++)
  {
    if (val % i == 0)
    {
      if (fre[i] > 0)
      {
        cerr << i << " " << fre[i] << endl;
        return false;
      }
      if (val / i != i)
      {
        if (fre[val / i] > 0)
        {
          cerr << val / i << " " << fre[val / i] << endl;
          return false;
        }
      }
    }
  }
  cerr<<1<<endl;
  return true;
}
void solve()
{
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> arr[i];
    elements.insert(arr[i]);
    fre[arr[i]]++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
  {
    int value = arr[i];
    if (fre[value] > 1)
      continue;
    else
    {
      if (check(arr[i]))
        ans++;
    }
  }
  cout << ans << endl;
  //check(16);
}
int main()
{
  FASTIO
  long long int t = 1;
  //cin>>t;
  while (t--)
    solve();
  return 0;
}


Measured memory_bytes: 16668
import java.util.Scanner;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        String r = "";
        if(a < b && b < c) {
            r = "Yes";
        }
        else {
            r = "No";
        }
        System.out.println(r);

        sc.close();
    }
}


Measured memory_bytes: 26236
N = int(input())
count=0
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
for i in range(N-2):
  if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
    print("Yes")
    exit(0)
print("No")


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

int main(){
  int n,i;
  int h[100001];
  int max = -1;
  int flag = 0;

  scanf("%d", &n);

  for(i = 0;i < n;i++){
    scanf("%d", &h[i]);
    if(max < h[i]) max = h[i];

    if(max - h[i] >= 2) flag = 1;
  }

  if(flag == 1) printf("No\n");

  else printf("Yes\n");

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <utility>
#include <cmath>
#include <string>
#include <bitset>
#include <queue>
#include <cstdio>
#include <cstring>
#include <deque>
#include <unordered_map>
#include <climits>
#include <map>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <ctime>
#include <cstdint>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define fa(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>b;--i)
#define setp pair<pair<int,int>,int>
#define setl pair<LL,LL>
#define M_PI 3.14159265358979323846

using namespace std;

LL gcd(LL a, LL b) { return a % b ? gcd(b, a % b) : b; }
LL lcm(LL a, LL b) { return (a * b) / gcd(a, b); }
pair <int, int> vu[8] = { {0,1}, {1,0} , {1,-1},{0,-1},{-1,0},{-1,1},{0,1}, {1,0} }; // EWSN

const int max_v = 1e5 + 7;
const int INF = 1e7 + 7;

LL arr[max_v];
int n;
LL ans = 1;
LL pans;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);	
	ci(n);
	fa(i, 0, n)
	{
		ci(arr[i]);		
	}
	fa(i, 0, n)
	{
		if (!arr[i])
		{
			co(0);
			return 0;
		}
	}
	ans =pans= arr[0];
	fa(i, 1, n)
	{
		ans *= arr[i];


		if ((ans / arr[i]) != pans || (ans > 1000000000000000000) || ans<0 || ans <pans)
		{
			co(-1);
			return 0;
		}
		pans = ans;
	}
	co(ans);
	return 0;
}

Measured memory_bytes: 4400
m, f, r = map(int, input().split())
while 1:
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1\
    or m + f < 30:
        print("F")
    elif m + f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif m + f < 65:
        print("C")
    elif m + f < 80:
        print("B")
    else:
        print("A")
    m, f, r = map(int, input().split())

Measured memory_bytes: 7668
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g

a,b = map(int,input().split())

print((a*3+b)//2)












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

int main()
{
	int n;
	int p[MAX];
	int counter;
	
	p[0] = 0;
	p[1] = 0;
	for (int i = 2; i < MAX; i++) {
		p[i] = 1;
	}
	
	int j = 2;
	while (j < MAX) {
		if (p[j] == 0) {
			j++;
		} else {
			for (int k = j *2; k < MAX; k += j)
				p[k] = 0;
			j++;
		}
	}
	
	while (1) {
		int a, d, n;
		int counter = 0;
		cin >> a >> d >> n;
		if ((a == 0) && (d == 0) && (n == 0)) {
			break;
		}
		int i = -1;
		while (counter < n) {
			i++;
			if (p[a + i * d] == 1) {
				counter++;
			}
		}
		cout << a + i * d << endl;
	}
	return 0;
}

Measured memory_bytes: 5064
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int ans = solve(a, b, c);
        System.out.println(ans);
    }

    private static int solve(int a, int b, int c) {
        int max = 0;
        max = Math.max(a, b);
        max = Math.max(max, c);

        int[] line = { a, b, c };
        int ans = 1;
        for (int i = 0; i < 3; i++) {
            if (line[i] == max) {
                continue;
            } else {
                ans *= line[i];
            }
        }
        ans /= 2;

        return ans;
    }
}


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

int main() {
    int N, M;
    cin>>N>>M;
    cout << N*(N-1)/2 + M*(M-1)/2 << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))

a = [a1, a2, a3]

n = int(input())
b = ["" for i in range(n)]
for i in range(n):
    b[i] = int(input())

a_hit = [[False, False, False],
         [False, False, False],
         [False, False, False]]

for i in range(3):
    for j in range(3):
        if a[i][j] in b:
            a_hit[i][j] = True

if (a_hit[0][0]) and (a_hit[0][1]) and (a_hit[0][2]):
    print("Yes")
elif (a_hit[1][0]) and (a_hit[1][1]) and (a_hit[1][2]):
    print("Yes")
elif (a_hit[2][0]) and (a_hit[2][1]) and (a_hit[2][2]):
    print("Yes")
elif (a_hit[0][0]) and (a_hit[1][0]) and (a_hit[2][0]):
    print("Yes")
elif (a_hit[0][1]) and (a_hit[1][1]) and (a_hit[2][1]):
    print("Yes")
elif (a_hit[0][2]) and (a_hit[1][2]) and (a_hit[2][2]):
    print("Yes")
elif (a_hit[0][0]) and (a_hit[1][1]) and (a_hit[2][2]):
    print("Yes")
elif (a_hit[0][2]) and (a_hit[1][1]) and (a_hit[2][0]):
    print("Yes")
else:
    print("No")


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

#define mod 1000000007
#define modd 998244353
#define PI 3.1415926
#define ll long long
#define ld long double
#define pb push_back
#define popb pop_back
#define beg begin()
#define en end()
#define sz(v) (int)((v).size())
#define all(v) (v).begin(),(v).end()
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define endl "\n"
#define forn(i,a,n) for(int i=a;i<int(n);++i)
#define forb(i,a,n) for(int i=int(n)-1;i>=a;--i)
#define cout(ans) cout<< ans << "\n"
#define couts(ans) cout<< ans <<" "
#define coutss(a,b) cout<< a <<" "<< b << "\n"
#define coutsm(a,b,c) cout<< a <<" "<< b <<" "<< c << "\n"
#define maxx *max_element
#define minn *min_element


void speed()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    cout.tie(NULL);
}



// ld dp[3005][3005];
// ld p[3005];

void solve()
{      
    int n;cin>>n;
    ld p[n+1];
    forn(i,1,n+1)
    {
        cin>>p[i];
    }
    ld dp[n+1][n+1];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    // dp[1][0]=1-p[0];
    // dp[1][1]=p[0];
    // coutss(dp[0][1],"DJJ");
    forn(i,1,n+1)
    {
        forn(j,0,i+1)
        {
            // coutsm(dp[0][1],i,j); 

            if(j)
            {
                dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
                // coutsm(dp[i][j],dp[i-1][j],dp[i-1][j-1]);
                // if(i==2 && j==1)
                // coutsm(dp[i][j],dp[i-1][j]*(1-p[i-1]),dp[i-1][j-1]*p[i-1]);
            }
            else
            {
                dp[i][j]=dp[i-1][j]*(1-p[i]);
            }

            // coutsm(dp[1][1],i,j); 

        }
    }
    // forn(i,1,n+1)
    // {
    //     forn(j,0,i+1)
    //     {
    //        coutsm(dp[i][j],i,j);
    //     }
    //     // cout<<endl;
    // }


    ld ans=0;
    forn(i,1,n+1)
    {
        if(i>(n-i))
        {
            ans+=dp[n][i];
        }
    }
    cout<<fixed<<setprecision(9)<<ans<<endl;

}


int main()
{   
    speed();
    int tc=1;
    // cin>>tc;
    while(tc--)
    {
        solve();
    }
}

Measured memory_bytes: 144432
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;

int main(){
  ll n,a;
  cin >> n >> a;
  string ans;
  ans = (n%500<=a) ? "Yes" : "No";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
H = list(map(int,input().split()))
stp = 0
for i in range(N-1):
    if H[i] == H[i+1]+1:
        H[i+1] += 1
    elif H[i+1] >= H[i]:
         pass
    else:
        stp += 1
        print("No")
        break
if stp == 0:
    print("Yes")

Measured memory_bytes: 63856
X, K, D = [abs(int(i)) for i in input().strip().split(' ')]

tmp = X // D
d1 = X - (D * tmp)
d2 = X - (D * (tmp + 1))

if tmp >= K:
  ans = X - (D * K)
else:
  if (tmp % 2) ^ (K % 2) == 0:
    ans = d1
  else:
    ans = d2

print(abs(ans))


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

using namespace std;

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	int n;
	vector<int> a, b, order;

	scanf("%d", &n);

	for (int i = 0; i < n; i++){
		int x;
		scanf("%d", &x);
		a.push_back(x);
	}

	for (int i = 0; i < n; i++){
		int x;
		scanf("%d", &x);
		b.push_back(x);
	}

	for (int i = 0; i < n; i++){
		order.push_back(i+1);
	}

	int ind = 1, orda = -1, ordb = -1;

	do {
		if (orda == -1){
			for (int i = 0; i < n; i++){
				if (order[i] != a[i])
					break;
				else if (i == n-1)
					orda = ind;
			}
		}
		if (ordb == -1){
			for (int i = 0; i < n; i++){
				if (order[i] != b[i])
					break;
				else if (i == n-1)
					ordb = ind;
			}
		}
		ind++;
	} while (next_permutation(order.begin(), order.end()));
	
	printf("%d\n", abs(orda - ordb));

	return 0;
}

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

int main()
{
	long double const pi = 3.1415926535;
	long double a, b, h, m;

	cin >> a >> b >> h >> m;

	long double xa = a * cosl(h * pi / 6 + m * pi / 360);
	long double ya = a * sinl(h * pi / 6 + m * pi / 360);
	long double xb = b * cosl(m * pi / 30);
	long double yb = b * sinl(m * pi / 30);

	cout << fixed << setprecision(12) << hypotl(xa - xb, ya - yb) << '\n';
	return 0;
}

Measured memory_bytes: 4192
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

struct mint {
    LL x; // typedef long long LL;
    mint(LL x=0):x(x%mod){}
    mint& operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator-=(const mint a) {
      if ((x += mod-a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator*=(const mint a) {
      (x *= a.x) %= mod;
      return *this;
    }
    mint operator+(const mint a) const {
      mint res(*this);
      return res+=a;
    }
    mint operator-(const mint a) const {
      mint res(*this);
      return res-=a;
    }
    mint operator*(const mint a) const {
      mint res(*this);
      return res*=a;
    }
    mint pow(LL t) const {
      if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
      if (t&1) a *= *this;
      return a;
    }

    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a) {
      return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
      mint res(*this);
      return res/=a;
    }
  };


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    LL N,A,B; cin >> N >> A >> B;
    mint ans = 0;

    mint all = 2;
    all = all.pow(N) - 1;
    mint suba = 1, subb = 1;

    REP(i,A){
        suba *= (N-i);
        suba /= (A-i);
    }
    REP(i,B){
        subb *= (N-i);
        subb /= (B-i);
    }
    dump(all.x)
    dump(suba.x)
    dump(subb.x)
    cout << (all - suba - subb).x << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int INF = LLONG_MAX/3;
const int MAX = 710000;

/*-----Library-----*/

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct UnionFind {
    vector<int> par; // 親ノード
    vector<int> rank; // ランク
    vector<int> sizeuf; //要素数
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n); rank.resize(n); sizeuf.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
            sizeuf[i]=1;
        }
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        sizeuf[x]+=sizeuf[y];
        return true;
    }

    int size(int x){
        return sizeuf[root(x)];
    }
};

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

long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}
//コンビネーション
/*
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    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 COM(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;
}
 */
/*-----Library-----*/
int n,m;
vector<P> e[110000][3];
int dis[110000][3];
void bfs(int s){
    for(int i=0;i<110000;i++){
        for(int j=0;j<3;j++){
            dis[i][j]=INF;
        }
    }
    dis[s][0]=0;
    queue<P> task;
    task.push(P(s,0));
    while(!task.empty()){
        P q=task.front(); task.pop();
        for(int i=0;i<e[q.first][q.second].size();i++){
            if(dis[e[q.first][q.second][i].first][e[q.first][q.second][i].second]>dis[q.first][q.second]+1){
                dis[e[q.first][q.second][i].first][e[q.first][q.second][i].second]=dis[q.first][q.second]+1;
                task.push(P(e[q.first][q.second][i].first,e[q.first][q.second][i].second));
            }
        }
    }
}
signed main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        u--;
        v--;
        e[u][0].push_back(P(v,1));
        e[u][1].push_back(P(v,2));
        e[u][2].push_back(P(v,0));
    }
    int s,t;
    cin>>s>>t;
    s--;
    t--;
    bfs(s);
    if(dis[t][0]==INF)cout<<-1<<endl;
    else cout<<dis[t][0]/3<<endl;
}


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

#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}

void solve(){
        
        int a,b,c,d,fo = 1;
        cin >> a >> b >> c >> d;
        while(true){
            if(c <= b){fo = 1;break;}
            else c -= b;
            if(a <= d){fo = 0;break;}
            else a -= d;
        }
    if(fo)cout << "Yes\n";
    else cout << "No\n";    
    // string s;
    // cin >> s;

}

signed main()
{
    showoff;
    int t;
    //cin >> t;
    t = 1;
    while(t--){
        solve();
    }
    
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ... 


Measured memory_bytes: 3612
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<numeric>
using namespace std;

int main(void)
{
	long long K;
	cin >> K;

	const long long N = 50;
	vector<long long> table(N, 0);
	iota(table.begin(), table.end(), 0);

	long long a = K / N;
	long long b = K % N;
	for(long long i=0; i<N; i++)
		table[i] += a;

	for(long long i=0; i<b; i++)
	{
		table[i] += N;
		for(long long j=0; j<N; j++)
		{
			if(j == i)
				continue;

			table[j]--;
		}
	}

	cout << N << endl;
	cout << table[0];
	for(int i=1; i<N; i++)
		cout << " " << table[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
//ABC124A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

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

Measured memory_bytes: 256
#ceilevenoddformula
import math
from queue import PriorityQueue
import bisect
import copy
import time
from collections import Counter
#map(int,input().split())
#int(x) for x in input().split()
n=int(input())
x=input()
x=list(x)
w=0
f=0
a=0
r=n-1
ans=min(x.count('W'),x.count('R'))
while w<=r:
	if x[w]=='W' and x[r]=='R':
		w+=1
		r-=1
		a+=1
	elif x[w]=='R':
		w+=1
	elif x[r]=='W':
		r-=1

print(min(a,ans))






















 
          





























Measured memory_bytes: 79580
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j, v;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  trace(A, n);
  for(i=2;i<=n;i++){
    v=A[i];
    j=i-1;
  while(j>=0&&A[j]>v){
    A[j+1]=A[j];
    j--;
    A[j+1]=v;
  }
   trace(A,n);
  }
  return 0;
}

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

char s[1001];
int sum[3][1001][1001];
int main() {
	int m, n, k; scanf("%d%d%d", &m, &n, &k);
	rep(i, m) {
		scanf("%s", s);
		rep(j, n) {
			if (s[j] == 'J')sum[0][i + 1][j + 1]++;
			else if (s[j] == 'O')sum[1][i + 1][j + 1]++;
			else sum[2][i + 1][j + 1]++;
		}
	}
	rep(k, 3)for (int i = 1; i <= m; i++)for (int j = 1; j <= n; j++)
		sum[k][i][j] += sum[k][i][j - 1];
	rep(k, 3)for (int i = 1; i <= n; i++)for (int j = 1; j <= m; j++)
		sum[k][j][i] += sum[k][j - 1][i];
	rep(i, k) {
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		rep(t, 3) {
			if (t)printf(" ");
			printf("%d", sum[t][c][d] - sum[t][a - 1][d] - sum[t][c][b - 1] + sum[t][a - 1][b - 1]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 14820
/// b.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < ll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,m;
    fi>>n>>m;
    static vi g[1 << 20];
    while (m --)
    {
        int a,b;
        fi>>a>>b;
        g[a].pb(b);
        g[b].pb(a);
    }
    static int was[1 << 20];
    vi order;
    function < void(int) > dfs = [&](int node)
    {
        order.pb(node);
        was[node] = 1;
        for (auto it : g[node])
            if (!was[it])
            {
                dfs(it);
                break;
            }
    };
    int cnt = 0;
    was[1] = 1;
    vi answer;
    answer.pb(1);
    for (auto it : g[1])
        if (!was[it])
        {
            order.clear();
            ++cnt;
            dfs(it);
            if (cnt & 1)
            {
                for (auto ii : order)
                    answer.pb(ii);
            }
            else
            {
                reverse(answer.begin(),answer.end());
                for (auto ii : order)
                    answer.pb(ii);
            }
            if (cnt == 2)
                break;
        }
    fo << answer.size() << '\n';
    for (auto it : answer)
        fo << it << ' ';
    fo << '\n';
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 32632
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    int N, M;
    cin>>N>>M;
    if(N==M) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define MEM(x) memset(x,0,sizeof(x))
#define vc vector<int>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define inf 0x3f3f3f3f
#define t_case int tt; cin>>tt; while (tt--)
#define lnginf 9223372036854775807
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define For(i,j,k) for (int i=(int)(j);i<(int)(k);i++)
#define rFor(i,j,k) for (int i=(int)(k-1);i>=(int)(j);i--)
#define ins insert
#define in(x); { for (auto &i : x) cin >> i; }
#define out(x); { for (auto i : x) cout<<i<<' ' ; }
#define pi  pair<int,int>
#define ti tuple<int,int,int>
#define PI 3.14159265359
#define des(x) setprecision(x)
const long long LL_INF = (long long) 2e18 + 5;
using namespace std;
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
const int N=3e5+10;

void solve(){
  string a,b; cin>>a>>b;
  int n=a.size(),m=b.size();
  int ans=inf;
  For(i,0,n-m+1){
    int ct=0;
    int k=0;
    For(j,i,i+m){
      if(a[j]!=b[k++])ct++;
    }
    ans=min(ans,ct);
  }
  cout<<ans<<'\n';
  
}
int32_t main() {

#ifndef ONLINE_JUDGE
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
#endif
   fastio
   //t_case
    solve();



}

Measured memory_bytes: 3656
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var a int
	var b string
	fmt.Scan(&a, &b)

	barray := strings.Split(b, ".")
	var bstr string
	for _, bi := range barray {
		bstr += bi
	}
	bint, _ := strconv.Atoi(bstr)

	fmt.Println(a * bint / 100)
}


Measured memory_bytes: 1820
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a)  (a).begin(),(a).end()
#define P pair<int, int>
#define ll long long
const int MOD = 1000000007;
//bitset<64>(x).count()
//fixed << setprecision(15) << 

int main (){
  int x;
  cin >> x;
  cout << 1-x << endl;
}


Measured memory_bytes: 3628
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class Main {

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

        List<List<Integer>> to = new ArrayList<>(100005);
        for (int i = 0; i < 100005; i++) {
            to.add(new ArrayList<Integer>());
        }

        for (int i = 0; i < m; i++) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            A--;
            B--;
            to.get(A).add(B);
            to.get(B).add(A);
        }
        sc.close();

        int[] dist = new int[100005];
        Arrays.fill(dist, -1);
        int[] pre = new int[100005];
        Arrays.fill(pre, -1);

        dist[0] = 0;
        Queue<Integer> queue = new LinkedList<Integer>();
        queue.offer(0);
        while (!queue.isEmpty()) {
            int v = queue.poll();

            for (Integer u : to.get(v)) {
                if (dist[u] == -1) {
                    dist[u] = dist[v] + 1;
                    pre[u] = v;
                    queue.offer(u);
                }
            }
        }

        System.out.println("Yes");
        for (int i = 0; i < n; i++) {
            if (i == 0)
                continue;
            int p = pre[i];
            p++;
            System.out.println(p);
        }
    }
}


Measured memory_bytes: 77536
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>
#include <stack>
#include <cstring>

using namespace std;

int main() {
    int n;
    double x[11];
    string u[11];

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

    double ans = 0;
    for (int i = 0; i < n; ++i) {
        if (u[i] == "JPY") {
            ans += x[i];
        } else {
            ans += 380000.0 * x[i];
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
import copy
try:
	while True:
		A = [[]]
		L = input()
		i = 0
		flag = 0
		for a in L:
			if a != "+" and a != "=":
				A[i].append(a)
			else:
				i = i + 1
				A.append([])
		for a in A:
			if "X" == a[0] and len(a) != 1:
				flag = 1
		for i in range(10):
			B = copy.deepcopy(A)
			for Bi,b in enumerate(B):
				for bi,k in enumerate(b):
					if k == "X":
						B[Bi][bi] = str(i)
				B[Bi] = int("".join(B[Bi]))
			if B[0] + B[1] == B[2]:
				if i == 0 and flag == 1:
					print("NA")
					flag = 2
				else:
					print(i)
					flag = 2
		if flag == 1 or flag == 0:
			print("NA")
except EOFError:
	pass

Measured memory_bytes: 8044