akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <stack>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long ll;

const int maxn = 2e5 + 7;

int n, x;

struct node {
  ll b, l, u, sorce;
  friend bool operator < (const node& x, const node& y) {
    if (x.sorce == y.sorce) return false;
    return x.sorce > y.sorce;
  }
} a[maxn];

ll check(ll t) {
  ll tim = t / x;
  ll res = t - tim * x;
  ll sum = 0;
  for (int i = 1; i <= tim; i++) {
    sum += a[i].sorce;
  }
  ll ans = 0;
  ans = sum;
  for (int i = 1; i <= n; i++) {
    ll now = 0;
    if (res <= a[i].b) 
      now = res * a[i].l;
    else 
      now = a[i].b * a[i].l + (res - a[i].b) * a[i].u;
    if (i <= tim) ans = max(ans, sum - a[i].sorce + now + a[tim + 1].sorce);
    else ans = max(ans, sum + now);
  }
  return ans;
}


int main() {
  scanf("%d%d", &n, &x);
  ll goal = 0, maxx = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld%lld", &a[i].b, &a[i].l, &a[i].u);
    maxx += a[i].b;
    goal += a[i].b * a[i].l;
    a[i].sorce = a[i].b * a[i].l + (x - a[i].b) * a[i].u;
  }
  sort(a + 1, a + n + 1);
  ll l = 0, r = (long long)n * x;
  while (l < r) {
    ll mid = (l + r) / 2;
    if (check(mid) >= goal) r = mid;
    else l = mid + 1;
  }
  printf("%lld\n", r);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tii;
#define rep(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

int sum[200010];

void calc(int n){
  for(int i=1;i*i<=n;i++){
    if(n%i==0){
      sum[i]++;
      if(i*i==n) continue;
      sum[n/i]++;
    }
  }
}
int main(){
  int N; cin >> N;
  int A[N+1];
  for(int i=1;i<=N;i++){
    cin >> A[i];
  }
  int ans[N+1];
  memset(ans,0,sizeof(ans));  
  memset(sum,0,sizeof(sum));
  vector<int> s;
  int cnt = 0;
  for(int i=N;i>=1;i--){
    if(sum[i]%2!=A[i]){
      ans[i] = 1;
      cnt++;
      s.push_back(i);
      calc(i);
    }
  }
  cout << cnt << endl;
  reverse(s.begin(),s.end());
  for(auto x : s){
    cout << x << " ";
  }
}


Measured memory_bytes: 6192
#include<iostream>
#include<string>
using namespace std;
main(){
  string line;
  getline(cin, line);
  string str;
  bool isf = true;
  line += '.';

  for ( int i = 0; i < line.size(); i++ ){
    if ( line[i] == '.' ||
	 line[i] == ',' ||
	 line[i] == ' '  ){
      if ( 3 <= str.size() && str.size() <= 6 ){
	if ( !isf ) cout << " ";
	isf = false;
	cout << str;
      }
      str = "";
    } else str += line[i];
  }
  cout << endl;
}

Measured memory_bytes: 0
// includes
#include <cstdio>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <climits>
#include <bitset>

// macros
#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a); i<(b);++i)
#define rep(i, n) FOR(i, 0, n)

using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;

// solve

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n)cin >> a[i];
  int res = 0;
  rep(i, n){
    int minj = i;
    FOR(j, i, n){
      if(a[j] < a[minj]){
        minj = j;
      }
    }
    swap(a[i], a[minj]);
    if(i != minj)res++;
  }
  rep(i, n){
    cout << a[i];
    if(i + 1 == n)cout << endl;
    else cout << " ";
  }
  cout << res << endl;
	return 0;
}



Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        /* code */
        cin >> p[i];
    }
    for (int i = 1; i < n - 1 ; i++)
    {
        /* code */
        if(p[i-1] < p[i] &&  p[i] < p[i+1] ||p[i+1] < p[i]  && p[i] < p[i-1]  ){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int i,n,l;
    cin>>n>>l;
    vector<string>s(n);
    for(i=0;i<n;i++){
        cin>>s[i];
    }
    sort(s.begin(),s.end());
    for(i=0;i<n;i++){
        cout<<s[i];
    }
    cout<<endl;
    return 0;
}




Measured memory_bytes: 3620
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int64_t> positive;
    vector<int64_t> negative;

    for (int i = 0; i < n; i += 1) {
        int num;
        cin >> num;

        if (num >= 0) {
            positive.push_back(num);
        } else {
            negative.push_back(-num);
        }
    }
    reverse(negative.begin(), negative.end());

    int64_t res = (1LL << 60);
    for (size_t i = 0; i <= min<size_t>(k, positive.size()); i += 1) {
        if (negative.size() < k - i) {
            continue;
        }

        auto dist_positive = (i > 0 ? positive[i - 1] : 0);
        auto dist_negative = (k - i > 0 ? negative[k - i - 1] : 0);
        auto dist_retrace = min(dist_positive, dist_negative);
        res = min(res, dist_positive + dist_negative + dist_retrace);
    }

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


Measured memory_bytes: 1656
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      m: usize,
      ab: [(usize, usize); m],
   }
   let mut to = vec![vec![]; n];
   for &(a, b) in ab.iter() {
      to[a - 1].push(b - 1);
      to[b - 1].push(a - 1);
   }
   let mut ans = 0;
   for &(a, b) in ab.iter() {
      let mut q = std::collections::VecDeque::new();
      let mut visit = vec![false; n];
      q.push_back(0);
      while let Some(v) = q.pop_front() {
         if visit[v] {
            continue;
         }
         visit[v] = true;
         for &u in to[v].iter() {
            if visit[u] || (u, v) == (a-1, b-1) || (u, v) == (b-1, a-1) {
               continue;
            }
            q.push_back(u);
         }
      }
      if !visit.iter().all(|&a| a) {
         ans += 1;
      }
   }
   println!("{}", ans);
}


Measured memory_bytes: 4352
#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! get_char {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().chars().collect::<Vec<_>>()
        }
    };
}

use std::collections::HashSet;

fn main() {
    let n = get!(usize);
    let s = get!(String; n);

    let s = s.into_iter().collect::<HashSet<_>>();
    println!("{}", s.len());
}


Measured memory_bytes: 19464
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N,A,B;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N>>A>>B;

	out << std::min(A, B) << " " << std::max(0, A + B - N) << endl;

	return 0;
}
#endif


Measured memory_bytes: 256
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 count = 0;

		for(int i = a; i <= b; i++) {
			if(c % i == 0) {
				count++;
			}
		}

		System.out.println(count);

	}
}


Measured memory_bytes: 26240
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;



int main() {
  string s,t;
  cin >> s >>t;
  int sa=s.size(),ta=t.size();
  int ans=1000000;
  rep(i,sa-ta+1){
    int g=0;
    rep(j,ta){
      if(s[i+j]!=t[j])g++;
    }
    chmin(ans,g);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

ll dp[1111][1111];

int main() {
    int q;
    cin >> q;
    while (q--) {
        string x, y;
        cin >> x >> y;
        int n = x.size(), m = y.size();
        for (int i = 0; i < 1111; i++) {
            for (int j = 0; j < 1111; j++) {
                dp[i][j] = 0;
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (x[i] == y[j]) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1);
                dp[i + 1][j + 1] = max({ dp[i + 1][j + 1], dp[i + 1][j], dp[i][j + 1] });
            }
        }
        cout << dp[n][m] << endl;
    }
}


Measured memory_bytes: 12860
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A,B; cin>>A>>B;
    for(int i=1;i<4;i++){
        int ans=0;
        ans=A*B*i;
        if(ans%2!=0){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, j, k) for(int i=j; i<=k; i++)
#define FFOR(i, j, k) for(int i=j; i<k; i++)
#define DFOR(i, j, k) for(int i=j; i>=k; i--)
#define bug(x) cerr<<#x<<" = "<<x<<'\n'
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
template <typename T> inline void read(T &x){
    char c;
    bool nega=0;
    while((!isdigit(c=getchar()))&&(c!='-'));
    if(c=='-'){
        nega=1;
        c=getchar();
    }
    x=c-48;
    while(isdigit(c=getchar())) x=x*10+c-48;
    if(nega) x=-x;
}
template <typename T> inline void writep(T x){
    if(x>9) writep(x/10);
    putchar(x%10+48);
}
template <typename T> inline void write(T x){
    if(x<0){
        putchar('-');
        x=-x;
    }
    writep(x);
}
template <typename T> inline void writeln(T x){
    write(x);
    putchar('\n');
}
#define taskname "C"
int n;
ll t[100];
int main(){
    #ifdef Megumin
        if(fopen(taskname".inp", "r"))
            freopen(taskname".inp", "r", stdin);
    #endif // Megumin
    cin>>n;
    FFOR(i, 0, n) cin>>t[i];
    ll ans=t[0];
    FFOR(i, 1, n) ans=ans*(t[i]/__gcd(ans, t[i]));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H & b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H & b) const { return x == b.x && y == b.y; }
	bool operator!=(const H & b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T & a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T & a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, k;
signed main() {
	cin >> n >> k;
	ld ans = 0;
	for (int i = 1; i <= n; i++) {
		ld res = 1;
		int t = i;
		while (t < k) {
			t *= 2, res /= 2.;
		}
		ans += res * 1.0 / n;
	}
	printf("%.20LF\n", ans);
}

Measured memory_bytes: 256
//IIT Kanpur FacelessMen India
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define foreach( gg,itit )  for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define mp make_pair
#define pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

pii arr[N];
ll fac[N];
int col[N],dep[N];
vector<int> G[N];
int main(){
  // freopen("product.in","r",stdin);
  // freopen("product.out","w",stdout);
  int n; ll x,y; scanf("%d%lld%lld",&n,&x,&y);
  pii mn[2];
  mn[0].X=mod;
  mn[1].X=mod;
  REP(i,n){
    int x,y;
    scanf("%d%d",&x,&y);
    arr[i]=mp(y,x);
    if(mn[0].X>y){
      if(mn[0].Y!=x) mn[1]=mn[0];
      mn[0]=mp(y,x);
    }else if(mn[1].X>y&&mn[0].Y!=x){
      mn[1]=mp(y,x);
    }
    G[x].pb(y);
  }
  REP(i,n+1) sort(all(G[i]));
  ll ans=1,tot=0;
//  printf("%d %d\n",mn[0].X,mn[1].X);
  fac[0]=1;
  REPP(i,1,N) fac[i]=fac[i-1]*i%mod;
  REP(i,n+1) {
    if(mn[0].Y==i){
      int ps=0;
      while(ps<G[i].size()&&G[i][ps]+mn[0].X<=x) ps++;
      col[i]=ps; 
    }else{
      int ps=0;
      while(ps<G[i].size()&&G[i][ps]+mn[0].X<=y) ps++;
      col[i]=ps; 
    }
    if(mn[1].X<mod&&mn[0].X+mn[1].X<=y&&mn[0].Y==i){
      int ps=0;
      while(ps<G[i].size()&&G[i][ps]+mn[1].X<=y) ps++;
      col[i]=max(col[i],ps);  
    }
    if(G[i].size()){
      int ps=0;
      while(ps<G[i].size()&&G[i][ps]+G[i][0]<=x) ps++;
      dep[i]=ps; 
      //printf("%d %d %d\n",i,dep[i],G[i][0]); 
    }
    //tot+=col[i];
    dep[i]=max(dep[i],col[i]);
    if(col[i]){
      tot+=dep[i];
      ans = ans*power(fac[dep[i]],mod-2)%mod;
    }
    //printf("%d %d\n",col[i],dep[i]);
   // ans = ans*fac[dep[i]]%mod*power(fac[col[i]],2*mod-4)%mod*power(fac[dep[i]-col[i]],mod-2)%mod;
    
  }
  REPP(i,1,tot+1){
    ans=ans*i%mod;
  }
  printf("%lld\n",ans);
  return 0;
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void print(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void print(H head, T ...tail) { cout << head << " "; print(tail...); }

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int n, m, k; read(n, m, k);
	bool ok = 0;
	rep(i, 0, n + 1) rep(j, 0, m + 1) if (i * m + j * n - i * j * 2 == k) ok = 1;
	print(ok ? "Yes" : "No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define ll  long long
    #define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define rep(i,a,b)  for(ll i=a;i<b;i++)
    #define per(i,a,b)  for(ll i=b-1;i>=a;i--)
    #define pb push_back
    #define Max(x,y,z) max(x,max(y,z))
    #define f first
    #define s second
    #define lbd lower_bound
    #define sz(x)       (ll)x.size()
    #define pi 3.1415926536
    #define mod 1000000007
    #define MOD 998244353
    #define maxi 100000000000000000
    using namespace std;
    const int N=120;
    /*bool isprime(ll x)
    {
        for(ll i=2;(i*i)<=x;i++)
        {
            if(x%i==0) return 0;
        }
        return 1;
    }*/
    /*ll power(ll x,ll n)
    {
        ll res=1;
        while(n>0){
        if(n%2) res=(res*x)%mod;
        x=(x*x)%mod;
        n=n/2;}
        return res;
    }*/
    void solve()
    {
                ll n,m,l=0,r=0,z,sum1=0,h,a,b,c,d,x=0,y=0;
                    cin>>n>>m;
                    ll ans=0;
                    ll ar[n];
                    rep(i,0,n) cin>>ar[i];

                    ll prefix[n]={0},suffix[n]={0};

                    rep(i,0,n)
                    rep(j,i+1,n) if(ar[i]>ar[j]) l++;
                    //cout<<l<<" ";
                    ans=(m*l)%mod;
                    rep(i,1,n)
                    {
                        rep(j,0,i)
                            if(ar[i]>ar[j]) prefix[i]++;
                       // cout<<prefix[i]<<" ";
                    }
                    //cout<<"\n";
                    rep(i,0,n)
                    {
                        rep(j,i+1,n)
                        if(ar[i]>ar[j]) suffix[i]++;
                        //cout<<suffix[i]<<" ";
                    }
                    rep(i,0,n)
                    {   r =((m-1)*m)/2LL;
                        r = r%mod;
                        ans += ((r*suffix[i])%mod+(r*prefix[i])%mod)%mod;
                        ans = ans%mod;
                    }
                    cout<<ans;
    }

            int main()
            {
                speed_up
                ll t=1;
                //cin>>t;
                while(t--)
                    solve();
            }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define CINVEC(vec) REP(i,(vec).size()) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    string A, C;
    string S;
    cin >> A >> S >> C;
    cout << "A" << S[0] << "C" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define de(x) cerr << #x << " = " << x << endl;

int main()
{            long long a, b, c;
			 cin >> a >> b >> c;

	         cout << min(b * c * (a&1), min(b * a * (c&1), a * c * (b&1)));
}
                                            

Measured memory_bytes: 256
x, k, d = map(int, input().split())
x = abs(x)
q = x // d
r = x % d

if k <= q:
  print(x - k * d)
else:
  if (k-q) % 2 == 0:
    print(r)
  else:
    print(abs(x - d * (q + 1)))

Measured memory_bytes: 9116
/* SHAHADATH HOSSAIN TAMIM
   BANGLADESH UNIVERSITY OF BUSINESS AND TECHNOLOGY
*/

#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define pob pop_back
#define sti(a) st.insert(a)
#define gcd __gcd
#define lcm(a,b) (a*b)/__gcd(a,b)
#define l s.length()
#define sts st.size()
#define mpss mps.size()
#define mpis mpi.size()
#define vs v.size()
#define sort(a) sort(a.begin(), a.end())
#define f(a,b) for(int i=a; i<b; i++)
#define fl(a,b) for(long long i=a; i<b; i++)

map<int, int>mpi;
map<string, int>mps;
set<int>st;
vector<int>v;
map<int, int>::iterator iti;
map<string, int>::iterator its;
set<int>:: iterator it;
vector<int>::iterator itv;

int main()
{
    //freopen("tamim.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    mpi.clear();
    mps.clear();
    st.clear();
    v.clear();

    ll n;
    cin>>n;
    ll p=n/500;
    n=n%500;
    ll q=n/5;
    cout<<p*1000+q*5<<endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;++i)
using namespace std;

int main()
{
  int n, x, ans;
  while (cin >> n >> x, n || x) {
    ans = 0;
    FOR(i, 1, n+1) FOR(j, i+1, n+1) FOR(k, j+1, n+1) {
      if (i + j + k == x) ++ans;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3084
/*ex9_2 hightierra*/
#include <stdio.h>
#include <stdlib.h>
#define LIMIT 100000

//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char cube;
    struct node *next;
}node;

//スタックのpush
void push(node **first, char cube){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->cube = cube;
    new->next = *first;
    *first = new;
}

//スタックのpop
char pop(node **first){
    char cube;
    node *tmp = *first;
    if(tmp == NULL){
        exit(1);
    }
    cube = tmp->cube;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return cube;
}

int main(void){
    int count=0,i;
    char cubic[LIMIT];
    //スタックの一番上
    node *first = NULL;

    //キューブの積み方
    scanf("%s",cubic);

    //キューブを最後まで積むまでループ
    i=0;
    while(cubic[i] != '\0'){ 
        //積み方通りにキューブを積む       
        push(&first,cubic[i]);
        //もしも、前のキューブと今のキューブの色が異なったら両方を取り除く
        if(first->next != NULL && (first->cube != first->next->cube)){
            pop(&first);
            pop(&first);
            count += 2;
        }
        i++;
    }
    
    printf("%d\n",count);
    
    return 0;
}

Measured memory_bytes: 4948
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define sp(x) fixed << setprecision(x)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
 
}



void solve()
{
	int n;
	cin >> n;
	ll t[n];
	ll g = 1;
	rep(i, n){
		cin >> t[i];
		g = t[i] / __gcd(g, t[i]) * g;
	}
	cout << g;
}

 
int main()
{
	// freopen("crosses.in", "r", stdin);
	// freopen("crosses.out", "w", stdout);
    Red;
  	int T = 1;
  	// cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;

namespace V1160{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var dx = new[]{0, 1, 0, -1, 1, 1, -1, -1};
            var dy = new[]{1, 0, -1, 0, 1, -1, 1, -1};

            while(true){
                var W = sr.Next<int>();
                var H = sr.Next<int>();
                var C = sr.Next<int>(H, W);
                if(W == 0 && H == 0) break;

                Func<int, int, bool> isInside = (x, y) => 0 <= x && x < W && 0 <= y && y < H;
                Action<int, int> dfs = null;
                dfs = (x, y) => {
                    for(var i = 0; i < 8; i++){
                        var nx = x + dx[i];
                        var ny = y + dy[i];
                        if(isInside(nx, ny) && C[ny][nx] == 1){
                            C[ny][nx] = 0;
                            dfs(nx, ny);
                        }
                    }
                };

                var res = 0;
                for(var i = 0; i < H; i++){
                    for(var j = 0; j < W; j++){
                        if(C[i][j] == 1){
                            res++;
                            dfs(j, i);
                        }
                    }
                }

                Console.WriteLine(res);
            }
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = _sr.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  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 <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
const int MOD = 1e9+7;
const int MOOD = 998244353;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

int n, m, q, ans;
int a[50], b[50], c[50], d[50];

void dfs(vector<int> &vec){
	if (vec.size() == n){
		int temp_ans = 0;
		for (int i = 0; i < q; i++){
			if (vec[b[i]-1] - vec[a[i]-1] == c[i]){
				temp_ans += d[i];
			}
		}
		ans = max(ans, temp_ans);
		return;
	}
	if (vec.size() == 0){
		for (int i = 1; i <= m; i++){
			vec.push_back(i);
			dfs(vec);
			vec.pop_back();
		}
	}else{
		for (int i = vec[vec.size()-1]; i <= m; i++){
			vec.push_back(i);
			dfs(vec);
			vec.pop_back();
		}
	}
	return;
}

int main(){
	cin >> n >> m >> q;
	for (int i = 0; i < q; i++){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	vector<int> vec;
	dfs(vec);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
/**
class cfmaster {
 public:
  struct code {
  	see the details down there !
  };
};
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
  	cin >> a[i];
	}
	long long ans = 0;
	sort(a.rbegin(), a.rend());
	for (int i = 0; i < n; i++) {
		if (k) {
			a[i] = 0;
			--k;
		} else {
			ans += a[i];
		}
	}
	cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n;
	cin >> n;
	vector<P<int>> a(n), b(n);
	rep(i, n) {
		cin >> a[i].first >> a[i].second;
	}
	rep(i, n) {
		cin >> b[i].first >> b[i].second;
	}
	sort(all(a));
	sort(all(b));
	vector<bool> used(n, false);
	int ans = 0;
	rep(i, n) {
		int pos = -1;
		int mx = -1;
		rep(j, n) {
			if (used[j]) continue;
			if (a[j].first > b[i].first || a[j].second > b[i].second) continue;
			if (chmax(mx, a[j].second)) pos = j;
		}
		if (pos != -1) ans++, used[pos] = true;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

vector<pair<ll,int>> v[101010];
int n;

bool chmin(pair<ll,ll>& p,pair<ll,ll> q){
    if(q.first<p.first){
        p=q;
        return true;
    }
    else if(p.first==q.first)(p.second+=q.second)%=mod;
    return false;
}

vector<pair<ll,ll>> solve(int s){
    vector<pair<ll,ll>> dist(n,{longinf,0});
    dist[s]={0,1};
    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> q;
    q.emplace(0,s);
    while(q.size()){
        auto p=q.top();q.pop();
        ll cur=p.second, d=p.first;
        if(dist[cur].first<d)continue;
        for(auto e : v[cur]){
            dist[cur].first+=e.first;
            if(chmin(dist[e.second], dist[cur]))q.emplace(dist[e.second].first,e.second);
            dist[cur].first-=e.first;
        }
    }
    return dist;
}

int main(){
    int m;
    cin>>n>>m;
    int s,t;
    cin>>s>>t;
    --s;--t;
    rep(i,m){
        int x,y,z;
        cin>>x>>y>>z;
        --x;--y;
        v[x].emplace_back(z,y);
        v[y].emplace_back(z,x);
    }
    auto ds=solve(s);
    auto dt=solve(t);
    ll d=ds[t].first;
    ll ans=0;
    rep(i,n){
        if(ds[i].first==dt[i].first&&2*ds[i].first==d){
            ll ret=ds[i].second*dt[i].second%mod;
            ans+=ret*ret%mod;
            ans%=mod;
        }
    }
    rep(i,n){
        for(auto to : v[i]){
            int j=to.second;
            if(ds[i].first+dt[j].first+to.first==d){
                if(2*ds[i].first<d&&2*dt[j].first<d){
                    ll ret=ds[i].second*dt[j].second%mod;
                    ans+=ret*ret%mod;
                    ans%=mod;
                }
            }
        }
    }
    cout<<(ds[t].second*ds[t].second-ans%mod+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 18772
#include <stdio.h>
int main(void){
    int a=0;
    scanf("%d",&a);
    //printf("a=%d\n",a);
    
    
    //素因数分解できるかを9から調べる
    int waretakazu=0;
    int i=0;
    for(i=9;i>=2;i--){
        if(a%i==0){
            waretakazu++;
            a=a/i;
            i++;
          //  printf("i=%d,a=%d\n",i,a);
        }
        
    }
    //printf("waretakazu=%d\n",waretakazu);
    
    if(waretakazu<=2&&a==1){
        printf("Yes");
    }else{
        printf("No");
    }
}


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

int next(int now, int base, int n){
    int a = base;
    while(now > a){
        a += n;
    }
    
    return a;
}

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

    int n;
    cin >> n;
    int c[n], s[n], f[n];
    rep(i,n-1) cin >> c[i] >> s[i] >> f[i];
    c[n-1] = s[n-1] = f[n-1] = 0;
    
    rep(i,n){
        int a = 0;
        for(int j=i; j<n-1; j++){
            a = next(a, s[j], f[j]);
            a += c[j];
            // cout << a << "|";
        }
        
        cout << a << endl;
    }
    
    // cout << 0 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int x, a, b;
    cin >> x >> a >> b;
    cout << (abs(a - x) < abs(b - x) ? 'A' : 'B') << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  long n, a;
  long cnt[200001] = {0};
  
  scanf("%ld", &n);
  for (int i = 1; i < n; i++) {
    scanf("%ld", &a);
    cnt[a] = cnt[a] + 1;
  }
  
  for (int i = 1; i <= n; i++) {
    printf("%ld\n", cnt[i]);
  }
  return 0;
}

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

int main()
{
	string str;
	cin >> str;

	long long k;
	cin >> k;

	int answer = 1;
	
	int i=0;
	int ones = 0;
	while(str[i] == '1' && i<str.length())
	{
		ones++;
		i++;
	}

	if (k<=ones) {
		cout << 1;
		return 0;
	}

	for (i = 0; i < str.length(); ++i)
	{
		if (str[i] != '1') 
		{
			answer = str[i] - '0';
			break;
		}

	}

	cout << answer;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int n;
           cin>>n;
           int a;
           cin>>a;
           cout<<n*n-a<<endl;
}

Measured memory_bytes: 3580
#include <iostream>

using namespace std;

int main(void)
{
	int a, b;
  
  cin >> a >> b;
  
  	if(a > b){
      for(int i = 0; i < a; i++){
        cout << b;
      }
    }else{
      for(int i = 0; i < b; i++){
        cout << a;
      }
    }
  
    return 0;
}

Measured memory_bytes: 256
n = int(input())
 
sum = (1+n)*n/2
 
n3 = n//3
n5 = n//5
n15 = n//15
 
sum3 = (1+n3)*n3/2 * 3
sum5 = (1+n5)*n5/2 * 5
sum15 = (1+n15)*n15/2 * 15
 
sum = sum + sum15 -sum3 -sum5
 
print(int(sum))

Measured memory_bytes: 9184
#include<iostream>
using namespace std;
int main(){
	int a,b,k,i;
	 cin>>a>>b>>k;
	 for(i=1;i<=k;i++){
	 	if(i&1){
	 		if(a&1){
	 			a--;
	 			a=a/2;
	 			b+=a;
			 }else{
			 	a=a/2;
			 	b+=a;
			 }
		 }else{
		 	if(b&1){
	 			b--;
	 			b=b/2;
	 			a+=b;
			 }else{
			 	b=b/2;
			 	a+=b;
			 }
		 } 
	 }
	cout<<a<<" "<<b<<endl;
	
	return 0;
}  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using G = vector<vector<int>>;
    
int main(){
    int n;
    cin >> n;
    map<string, int> cnt;
    rep(i,n){
        string s;
        cin >> s;
        cnt[s]++;
    }
    for(string s: {"AC", "WA", "TLE", "RE"}){
        cout << s << " x " << cnt[s] << endl; 
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

string S;

int main() {
    while (cin >> S) {
        int con = 0;
        for (auto c : S) if (c == 'o') ++con;
        cout << 700 + 100 * con << endl;
    }
}

Measured memory_bytes: 256
S = input()
n, e, w, s = 0, 0, 0, 0
for i in range(len(S)):
  if S[i] == 'N':
    n = 1
  elif S[i] == 'E':
    e = 1
  elif S[i] == 'W':
    w = 1
  elif S[i] == 'S':
    s = 1
if n == s and e == w:
  print('Yes')
else:
  print('No')

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

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

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }

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

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int main(){
	int a;scanf("%d",&a);
	printf("%d\n",800*a-200*(a/15));
}

Measured memory_bytes: 128
/**Bismillahir Rahmanir Rahim.**/
#include<bits/stdc++.h>
#define ln '\n'
#define sf scanf
#define pf printf

#define D(x) cout<< #x " = "<<x<<endl
#define cout(case)   cout << "Case " << ++cs << ": " ;
#define foreach(i,c) for(__typeof(c.begin())i=c.begin();i!=c.end();i++)


#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define _case cout<<"Case "<<++cs<<": "
#define lp(loop,start,end) for(ll loop=start;loop<=end;loop++)
#define lpd(loop,start,end) for(ll loop=end;loop>=start;loop--)



#define MOD 1000000007
#define countv(v,a) count(v.begin(),v.end(),a)
#define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define uniq(v) v.resize( unique(all(v)) - v.begin())


#define PI acos(-1)
#define ll long long int
#define ull unsigned long long

#define vi vector <int>
#define vll vector <ll>
#define vs vector <string>
#define pb push_back
#define mpii map <int,int>
#define mpsi map <string,int>
#define mpll map <long long,long long>
#define MP make_pair
#define F first
#define S second

#define GCD(a,b) __gcd(a,b)
#define LCM(a,b) (a*(b/__gcd(a,b)))



#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())

#define all(v) v.begin(),v.end()
#define MEM(a, b) memset(a, b, sizeof(a))

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

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

/// int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
/// int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
/// int dx[]={2,1,-1,-2,-1,1};int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/




const ll INF = 0x3f3f3f3f3f3f3f3f;
string s,s1;
ll n,m,a,b,i,j,d,t,cs=0,counT=0,k,ans=0,l=0,sum1=0,sum=0,Max,Min,num;
ll arr[10000000];
vector<ll>vc;
map<ll,ll>mp;


int CeilIndex(std::vector<ll>& v, int l, int r, int key)
{
	while (r - l > 1) {
		int m = l + (r - l) / 2;
		if (v[m] >= key)
			r = m;
		else
			l = m;
	}

	return r;
}

int LongestIncreasingSubsequenceLength(std::vector<ll>& v)
{
	if (v.size() == 0)
		return 0;

	std::vector<ll> tail(v.size(), 0);
	int length = 1;

	tail[0] = v[0];
	for (size_t i = 1; i < v.size(); i++) {

		if (v[i] < tail[0])
			tail[0] = v[i];

		else if (v[i] > tail[length - 1])
			tail[length++] = v[i];

		else
			tail[CeilIndex(tail, -1, length - 1, v[i])] = v[i];
	}

	return length;
}

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
    {
        cin >> a;
        vc.pb(a);
    }

	cout<< LongestIncreasingSubsequenceLength(vc) << '\n';
	return 0;
}




Measured memory_bytes: 4440
#import<iostream>
#define l long
l N,M,c,n=1,i=2,o=1e9+7;
l m(l a)
{
	l g=1,h=2*o-4;
	for(;h/=2;)
	{
		h&1?g=g*a%o:0;
		a=a*a%o;
	}
	return g;
}
l C(l b)
{
	l r=1,d=1;
	for(;b;r=r*(N-1+b)%o,d=d*b--%o);
	return r*m(d)%o;
}
main()
{
	for(std::cin>>N>>M;i*i<=M;++i)
	{
		for(c=0;M%i<1;++c,M/=i);
		n=n*C(c)%o;
	}
	std::cout<<n*(M^1?N:1)%o<<std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>
const int MAX_V = 1000000;
int prime[MAX_V+1],sum[MAX_V+2]={0};
int main(){
  int n;
  for(int i = 2;i <= MAX_V;i++){
    prime[i] = 1;
  }
  for(int i = 2;i * i <= MAX_V;i++){
    if(prime[i]){
      for(int k = 2* i;k <= MAX_V;k += i)
      prime[k]=0;
    }
  }
  for(int i = 2;i < MAX_V;i++){
    sum[i] +=sum[i-1]+prime[i];
  }
  while(scanf("%d",&n)!=EOF){
    printf("%d\n",sum[n]);
  }
  return 0;
}

Measured memory_bytes: 10492