akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, t: "List[int]", x: "List[int]", y: "List[int]"):
    pre_t, pre_x, pre_y = [0] * 3
    for i in range(N):
        dt = t[i] - pre_t
        move = x[i] - pre_x + y[i] - pre_y
        if dt < move or dt % 2 != move % 2: 
            print(NO)
            return
        pre_t = t[i]
        pre_x = x[i]
        pre_y = y[i]

    print(YES)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    t = [int()] * (N)  # type: "List[int]"
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        t[i] = int(next(tokens))
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, t, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 11636
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;

vector<vector<int>> v(200010);
vector<long long int> cost(200010, 0);
vector<bool> r(200010, false);
vector<long long int> plusx(200010, 0);

void update(int p, long long int x)
{
	r[p] = true;
	x += plusx[p];
	cost[p] += x;
	for(auto& t: v[p])
	{
		if(p != t and r[t] == false) update(t, x);
	}
}

int main()
{
	long long N, Q;
	cin >> N >> Q;
	for(int i = 0; i < N-1; i++)
	{
		int a, b;
		cin >> a >> b;
		v[a].push_back(b);
	}
	for(int i = 0; i < Q; i++)
	{
		int p, x;
		cin >> p >> x;
		plusx[p] += x;
	}

	update(1, 0);

	for(int i = 1; i <= N; i++)
	{
		cout << cost[i] << endl;
	}

	return 0;
}


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


int main() {
  string s;
  int q;
  cin >> s >> q;

  bool rflag = false;
  string head="", tail="";
  rep(_, q){
    int t;
    cin >> t;
    if (t == 1) rflag = !rflag;
    else{
      int f; char c;
      cin >> f >> c;
      if (rflag){
        if (f == 2) head += c;
        else tail += c;
      }else{
        if (f == 1) head += c;
        else tail += c;
      }
    }
  }
  if (rflag){
    reverse(s.begin(), s.end());
    reverse(tail.begin(), tail.end());
    s = tail + s + head;
  } else{
    reverse(head.begin(), head.end());
    s = head + s + tail;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 1348
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int ans = 0;
        if (S.contains("RRR")) {
            ans = 3;
        } else if (S.contains("RR")) {
            ans = 2;
        } else if (S.contains("R")) {
            ans = 1;
        } 
        System.out.println(ans);
    }
}

Measured memory_bytes: 35600
#include<stdio.h>
#include<stdlib.h>
int main(){
  int a,b,c,d,s1,s2;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  s1=a*b;
  s2=c*d;
  if(s1>=s2){printf("%d",s1);}else{
    printf("%d",s2);
  }
  return 0;
}

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

vector<int> divisors(int n)
{
    vector<int> v;
    for (int i = 1; i*i <= n; i++) {
        if (n % i == 0) {
            v.push_back(i);
            if (i*i != n) v.push_back(n/i);
        }
    }
    return v;
}

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> ds = divisors(M);
    sort(ds.begin(), ds.end());
    for (int i = ds.size() - 1; i >= 0; i--) {
        if (M / ds[i] >= N) {
            cout << ds[i] << endl;
            break;
        }
    }
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define repf(i, f, l) for(int i = f; i < (int)l; ++i)
#define repit(it, t) for(__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++)
#define endl "\n"
#define pb emplace_back
#define lb lower_bound
#define int long long
#define ul unsigned long
#define ull unsigned long long
#define ll long long
#define INF 1000000007
#define MOD 1000000007
#define fs first
#define sd second
#define DBG0(x) { cout << #x << ": " << x << "\t"; }
#define DBG(x) {DBG0(x); cout << endl;}
#define DBG2(x, y) {DBG0(x); DBG(y);}
#define DBG3(x, y, z) {DBG0(x); DBG2(y, z);}
#define DBG4(w, x, y, z) {DBG0(w); DBG3(x, y, z);}

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ul> vul;
typedef vector<ull> vull;
typedef vector<bool> vbl;
typedef pair<int, int> pii;

signed main(void){
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    vint v = vint();
    v.pb(a); v.pb(b); v.pb(c);
    sort(v.begin(), v.end());
    cout << v[0] * v[1] / 2 << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n, m;
    cin >> n >> m;
    long long lcm = 1;
    vector<long long>v(n + 3);
    for(int i = 1; i <= n; i++){
        cin >> v[i];
        if(v[i] != 4 && v[i] != 68){
        }
    }
    long long g = v[1];
    for(int i = 1; i <= n; i++){
        g = __gcd(g, v[i]);
        lcm = (v[i]/__gcd(lcm, v[i])) * lcm;
        if(lcm > 2 * m){
            cout << '0';
            return 0;
        }
    }
    if((lcm/g) % 2 == 0){
        cout << '0';
        return 0;
    }
    long long x = (2 * m)/lcm;
    cout << x/2 + (x % 2 != 0);
    return 0;
}

Measured memory_bytes: 3944
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define ld long double
#define ff first
#define ss second
const ll mod =   1e9 +7  ;
ll multiply(ll a, ll b ){ return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b) {     return ((a % mod) + (b % mod)) % mod; }
ll sub(ll a, ll b) { return ((a%mod) - (b % mod)+ mod) % mod ; }
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
void solve(){
   int n ;
   cin >> n ;
   int odd  = (n+1)/2 ;
   cout << fixed << setprecision(10) << odd*1.0 / n ;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t ;
    t = 1 ;
   //cin >> t ;
    while(t--){
        solve( );
    }
}
// number of subset having xor in 2ki ow


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;

int main(){
    int n;cin>>n;
    vector<int> h(n);
    rep0(i,n){
        cin>>h[i];
    }
    int ans=1;
    
    rep1(i,n){
        bool b=true;
        rep0(j,i){
            if(h[j]>h[i]){
                b=false;
            }
        }
        if(b){
            ans++;
        }
    }
    cout <<ans<<endl;
}

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

using namespace std;

int main(){


	int n;
	int *l;

	cin>>n;
	l = new int[2*n];

	for(int i=0;i<2*n;i++){
		cin>>l[i];
	}

	sort(l,l+2*n);

	int sum=0;

	for(int i=0;i<2*n;i+=2){
		sum+=l[i];
	}


	cout<<sum<<endl;

	return 0;


}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int MAX = 999999999;

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

    if(count(all(inp), 'a') == 1 && count(all(inp), 'b') == 1 && count(all(inp), 'c') == 1){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#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 rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, 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;

string SSORT(string in){
    string out=in;
    vector<char> charas;
    rep(i, in.size()) charas.push_back(in[i]);
    sort(all(charas));
    rep(i, out.size()) out[i]=charas[i];
    return out;
}

int main(void){
    ll N;
    string s;
    cin>>N;
    vector<string> S;
    rep(i, N){
        cin>>s;
        //cout<<SSORT(s)<<endl;
        S.push_back(SSORT(s));
    }
    sort(all(S));
    //rep(i, N) cout<<S[i]<<endl;
    ll thisc=1, count=0;
    rep1(i, S.size()-1){
        if(S[i]==S[i-1]) thisc++;
        else{
            count+=thisc*(thisc-1)/2;
            thisc=1;
        }
    }
    count+=thisc*(thisc-1)/2;
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 5748
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#define ll long long
#include<bits/stdc++.h>


using namespace std;

int main() {
	ll int a;
    int  b1,b2;
    cin>>a;
    scanf("%d.%d",&b1,&b2);
    cout<<(a*b1*100+a*b2)/100<<endl;
    return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  int n, m; cin >> n >> m;
  vector<string> a(n);
  vector<string> b(m);

  rep(i, n) {
    cin >> a.at(i);
  }
  rep(i, m) {
    cin >> b.at(i);
  }

  rep(i, n) {
    rep(j, n) {
      if (i+m > n || j+m > n) continue;
      bool flag = true;
      rep(k, m) {
        rep(l, m) {
          if (a.at(i+k).at(j+l) != b.at(k).at(l)) {
            flag = false;
            break;
          }
        }
        if (!flag) {
          break;
        }
      }
      if (flag) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<stack>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(n) n.begin(),n.end()
#define SIZE 2048*2

struct P{
  int x,y;
  P(int x1, int y1){x=x1,y=y1;}
};

bool board[SIZE][SIZE];

int compress(vector<int> &x1, vector<int> &x2, int W){
  vector<int> xs;
  unsigned int size = x1.size();
  for(int i=0; i<size; i++){
    for(int d=-1; d<=1; d++){
      int tx1 = x1[i] + d, tx2 = x2[i] + d;
      if(0<=tx1 && tx1 <=W) xs.push_back(tx1);
      if(0<=tx2 && tx2 <=W) xs.push_back(tx2);
    }
  }
  sort(all(xs));
  xs.erase(unique(all(xs)), xs.end());
  int end = 0;

  for(int i=0; i<size; i++){
    x1[i] = find(all(xs), x1[i]) - xs.begin();
    x2[i] = find(all(xs), x2[i]) - xs.begin();
    if(end<x2[i])
      end = x2[i];
  }
  return xs.size()-1;
}

void compress2(vector<int> &x1, vector<int> &x2, vector<int> &y1, vector<int> &y2, int &W, int &H){
  vector<int> xs, ys;
  unsigned int size = x1.size();
  for(int i=0; i<size; i++){
    for(int d=-1; d<=1; d++){
      int tx1 = x1[i] + d, tx2 = x2[i] + d, ty1 = y1[i] + d, ty2 = y2[i] + d;
      if(0<=tx1 && tx1 <=W) xs.push_back(tx1);
      if(0<=tx2 && tx2 <=W) xs.push_back(tx2);
      if(0<=ty1 && ty1 <=H) ys.push_back(ty1);
      if(0<=ty2 && ty2 <=H) ys.push_back(ty2);
    }
  }
  sort(all(xs)); sort(all(ys));
  xs.erase(unique(all(xs)), xs.end()); ys.erase(unique(all(ys)), ys.end());
  
  memset(board,0,sizeof(board));

  for(int i=0; i<size; i++){
    x1[i] = find(all(xs), x1[i]) - xs.begin();
    x2[i] = find(all(xs), x2[i]) - xs.begin();
    y1[i] = find(all(ys), y1[i]) - ys.begin();
    y2[i] = find(all(ys), y2[i]) - ys.begin();
    for(int y=y1[i]; y<y2[i]; y++){
      memset(board[y]+x1[i], 1, x2[i]-x1[i]);
    }
  }
  
  W = xs.size()-1; H = ys.size()-1;
}

void dfs(bool Map[SIZE][SIZE], P start, int W, int H){
  static const int dx[] = {0, 0, -1, 1}, dy[] = {1, -1, 0, 0};
  stack<P> st;
  st.push(start);
  while(st.size()){
    P s = st.top();
    st.pop();
    rep(i, 4){
      P t = P(s.x+dx[i], s.y+dy[i]);
      if(t.y>=0 && t.x>=0 && t.y<H && t.x<W && Map[t.y][t.x]==false){
	Map[t.y][t.x]=true;
	st.push(t);
      }
    }
  }
}

int main(){
  int W,H,N;
  while(cin>>W>>H, W|H){
    cin>>N;    
    vector<int> x1, x2, y1, y2;
    rep(i,N){
      int a, b, c, d;
      cin>>a>>b>>c>>d;
      x1.push_back(a);y1.push_back(b);
      x2.push_back(c);y2.push_back(d);
    }

    compress2(x1,x2,y1,y2,W,H);

    /*
    W = compress(x1, x2, W);
    H = compress(y1, y2, H);
    memset(board, 0, sizeof(board));
    rep(i, N){
      for(int y=y1[i]; y<y2[i]; y++){
	memset(board[y]+x1[i], 1, x2[i]-x1[i]);
      }
    }
    */

    int count = 0;
    rep(y, H){
      rep(x, W){
	if(board[y][x]!=true){
	  count++;
	  dfs(board, P(x, y), W, H);
	}
      }
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 19928
use std::io::stdin;
use std::str::FromStr;
use std::cmp::max;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn read_str_as_char_vec() -> Vec<char> {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().chars().collect()
}

fn read_str_as_T<T>() -> T 
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().unwrap()
}

fn main() {
    let in_vec: Vec<usize> = read_line();
    let n = in_vec[0];
    let m = in_vec[1];
    let q = in_vec[2];

    // $B0lC6(B 10 $B=E%k!<%W$G5a$a$F$_$k(B
    let mut reps = Vec::<(usize, usize, usize, usize)>::new();
    for _i in 0..q {
        let in_vec: Vec<usize> = read_line();
        reps.push((in_vec[0], in_vec[1], in_vec[2], in_vec[3]));
    }

    let mut res = 0;
    for l0 in 1..m+1 {
        for l1 in l0..=m {
            for l2 in l1..=m {
                for l3 in l2..=m {
                    for l4 in l3..=m {
                        for l5 in l4..=m {
                            for l6 in l5..=m {
                                for l7 in l6..=m {
                                    for l8 in l7..=m {
                                        for l9 in l8..=m {
                                            let mut temp = 0;
                                            let state = vec![l0, l1, l2, l3, l4, l5, l6, l7, l8, l9];
                                            for &(a, b, c, d) in reps.iter() {
                                                if state[b-1] - state[a-1] == c {
                                                    temp += d;
                                                }
                                            }
                                            res = max(res, temp);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

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


Measured memory_bytes: 2088
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES

int grid[1005][1005];
long long int dp[1005][1005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  // 	freopen("input.txt","r",stdin);
  //	freopen("output.txt","w",stdout);
   	int n,m;
   	cin>>n>>m;
   	for(int i=0;i<n;i++)
   	{
   		for(int j=0;j<m;j++)
   		{
   			char c;
   			cin>>c;
   			if(c=='.')
   			{
   				grid[i][j] = 1;
   			}
   			else
   				grid[i][j] = 0;
   		}
   	}
   	dp[1][1] = 1;
   	for(int i=1;i<=n;i++)
   	{
   		for(int j=1;j<=m;j++)
   		{
   			if(i==1 && j==1)
   				continue;
   			if(grid[i-1][j-1]==0)
   				dp[i][j] = 0;
   			else
   			{
   				if(i==1)
   				{
   					if(grid[i-1][j-2]==0)
   						dp[i][j] = 0;
   					else 
   						dp[i][j] = dp[i][j-1];
   				}
   				else if(j==1)
   				{
   					if(grid[i-2][j-1]==0)
   						dp[i][j] = 0;
   					else
   						dp[i][j] = dp[i-1][j];
   				}
   				else
   				{
   					dp[i][j] = (dp[i-1][j]+dp[i][j-1])%1000000007;
   				}
   			}
   		}
   	}


   	cout<<dp[n][m];

	return 0 ;
}

Measured memory_bytes: 12032
n=int(input())
s = input()
n=len(s)

left_black = [0 for i in range(n+1)]
right_white = [0 for i in range(n+1)]


b=0
for i in range(n):
    if s[i]=="#":
        b+=1
    left_black[i+1] = b

w=0
for i in reversed(range(n)):
    if s[i] == ".":
        w+=1
    right_white[i]=w

ans=int(1e9)
for i in range(n+1):
    ans = min(ans, left_black[i]+right_white[i])

print(ans)

Measured memory_bytes: 13032
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 2e3;
int n, a[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n) cin >> a[i];
  sort(a, a+n);
  int ans = 0;
  FOR(i, 0, n)FOR(j, 0, i)FOR(k, 0, j) ans += a[i]<a[j]+a[k];
  cout << ans << endl;
}

Measured memory_bytes: 256
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 10000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;

ll lcm(ll a,ll b)
{
    return (a*b)/__gcd(a,b);
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
ll arr[maxx+12];
void sieve()
{
    for(ll i=1;i<=maxx;i++){
        for(ll j=i;j<=maxx;j+=i){
            arr[j]++;
        }
    }
}
void Dufaux()
{
    ll n;
    cin>>n;
    long long ans=0;
    for(ll i=1;i<=n;i++){
        long long p=i*arr[i];
        ans+=p;
    }
    cout<<ans<<endl;
}
int main()
{
	FastIO;
	sieve();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






Measured memory_bytes: 81764
#include<iostream>
#include<cmath>
#include <vector>
using namespace std;
int main() 
{
  int a = 0;
  int b = 0;
 
  cin >> a >> b;
  
  if (a <= 9 && a >= 1) {
    if (b <= 9 && b >= 1) {
      cout << a * b << endl;
      return 0;
    }
  }

  cout << "-1" << endl;
 
  return 0;
}

Measured memory_bytes: 888
def gcd(a,b):
	if(a==0 or b==0):
		return a+b
	return gcd(b,a%b)
n,k=list(map(int,input().split()))
l=list(map(int,input().split()))
val=0
for c in l:
	val = gcd(val,c)
if(k%val==0 and k<=max(l)):
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

Measured memory_bytes: 14252
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int r, g, b;
int k;

int main()
{
	scanf("%d%d%d", &r, &g, &b);
	scanf("%d", &k);
	int reqCount = 0;
	while (r >= g) {
		g = g * 2;
		reqCount++;
	}
	while (g >= b) {
		b = b * 2;
		reqCount++;
	}
	
	if (reqCount <= k) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	
	return 0;
}



Measured memory_bytes: 1632
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <unordered_map>
using namespace std;


vector<string>split(string s, char delim){
  int len = s.length();
  string currStr = "";
  vector<string>retVec;
  for(int i = 0;i<len;i++){
    char ch = s[i];
    if(ch==delim){
      retVec.push_back(currStr);
      currStr = "";
    }else{
      currStr += ch;
    }
  }
  retVec.push_back(currStr);
  return retVec;
}



vector<int>strToIntVec(string s){
  int len = s.length();
  //  s = s.substr(1,len-2);
  vector<string>strVec = split(s,' ');
  vector<int>retVec;
  for(int i=0;i<strVec.size();i++){
    int el = atoi(strVec[i].c_str());
    retVec.push_back(el);
  }
  return retVec;
}

class GridColor{
public:
  int getNumSel(int h, int w, int k, vector<string>&grid){
    int nSel = 0;
    int nPerms = 1<<(h+w);
    for(int i=0;i<nPerms;i++){
      if(checkSel(h,w,k,grid,i)){
	nSel++;
      }
    }
    return nSel;
  }

  bool checkSel(int h, int w, int k, vector<string>&grid, int pNum){
    unordered_map<int,bool>rUsed;
    unordered_map<int,bool>cUsed;
    rUsed.clear();
    cUsed.clear();
    for(int i=0;i<h;i++){
      if((pNum%2)==1){
	rUsed[i] = true;
      }
      pNum/=2;
    }
    for(int i=0;i<w;i++){
      if((pNum%2)==1){
	cUsed[i] = true;
      }
      pNum/=2;
    }
    int nBlack = 0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if((grid[i][j]=='#')&&(rUsed.find(i)==rUsed.end())&&(cUsed.find(j)==cUsed.end())){
	  nBlack++;
	}
      }
    }
    return (nBlack==k);
  }
};

int main(int argc, const char*argv[]){
  GridColor gc;
  string hwkLn;
  getline(cin,hwkLn);
  vector<int>hwkVec = strToIntVec(hwkLn);
  int h = hwkVec[0];
  int w = hwkVec[1];
  int k = hwkVec[2];
  vector<string>grid;
  for(int i=0;i<h;i++){
    string rowLn;
    getline(cin,rowLn);
    grid.push_back(rowLn);
  }
  int nSel = gc.getNumSel(h,w,k,grid);
  cout<<nSel<<endl;
  return 0;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)      //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++)    //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> PII;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);
    
    int n, u, v; cin >> n >> u >> v;
    --u;--v;
    vii tree(n);
    rep(i,n-1) {
        int a,b;
        cin >> a >> b;
        --a;--b;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }

    //bfs
    queue<int> que;
    vi dist_aoki(n,-1);
    dist_aoki[v] = 0;
    que.push(v);
    while(que.size()) {
        int node = que.front();
        que.pop();
        for(auto nnode : tree[node]) {
            if(dist_aoki[nnode]!=-1) continue;
            dist_aoki[nnode] = dist_aoki[node]+1;
            que.push(nnode);
        }
    }

    vi dist_taka(n,-1);
    dist_taka[u] = 0;
    que.push(u);
    while(que.size()) {
        int node = que.front();
        que.pop();
        for(auto nnode : tree[node]) {
            if(dist_taka[nnode]!=-1) continue;
            dist_taka[nnode] = dist_taka[node]+1;
            que.push(nnode);
        }
    }

    //where T should go?
    int A;
    for(int i = 0; i < n; ++i) {
        if(dist_aoki[i]<=dist_taka[i]) continue;
        chmax(A, dist_aoki[i]);
    }

    cout << A-1 << '\n';  // T + (A-T-1) = A-1 
}

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

#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

int32_t main(){
	NINJA;

	int n; cin >> n;

	double sum = 0;

	fo(i,n){
		double x; cin >> x;
		sum += 1/x;
	}

	double ans = 1/(sum*1.0);

	printf("%0.5f\n",ans);
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long 
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define endl "\n"
using namespace std;

ll gcd(ll a, ll b){
    return __gcd(a,b);
}

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

bool isPrime(ll n){
    if(n <= 1) return false;
    for(ll i=2; i<=sqrt(n); i++){
        if(n%i == 0){
            return false;
        }
    }
    return true;
}

void solve(){
    ll n,res =0;
    cin >> n;
    ll a[n];
    for(ll i=0; i<n; i++){
        cin >> a[i];
        //res += a[i];
    }
    sort(a,a+n);
    ll k = n-2,i=n-2;
    res += a[n-1];
    while(k >= 2 ){
        res += (2*a[i--]);
        k -= 2;
    }
    if(k == 0){
        cout << res << endl;
    }
    else{
        cout << res + a[i] << endl;
    }
}

int main() {
    fast;
    solve();
	//ll t; cin >> t; while(t--){ solve(); }
	return 0;
}

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

int t[4];
int n[4];
int ans;

int main(){
	for(int i = 0; i < 4; i++){			
		cin >> t[i] >> n[i];
	}
	
	for(int i = 0; i < 4; i++){
		if(t[i] == 1){
			ans = 6000 * n[i];
		} else if(t[i] == 2){
			ans = 4000 * n[i];
		} else if(t[i] == 3){
			ans = 3000 * n[i];
		} else if(t[i] == 4){
			ans = 2000 * n[i];
		}	
		
		cout << ans << endl;
	}	
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define dbg(x) cout << #x << ": " << (x) << '\n'
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
const int inf = 1e5 + 1;

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

   int n, k;
   cin >> n >> k;
   vector <int> a(n);
   for (auto &i: a)
      cin >> i;

   vector <int> dp(k + 1);
   for (int i = 0; i <= k; i++) {
      for (int j = 0; j < n; j++) {
         if (i - a[j] >= 0) {
            dp[i] |= !(dp[i - a[j]]);
         }
      }
   }

   if (dp[k])
      cout << "First" << '\n';
   else
      cout << "Second" << '\n';

   return 0;
}

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

typedef long long ll;
int k[2020],f[2000005],a[2000005],g[2000005];
ll sum;

int main()
{
    string s;
    cin>>s;
    int n=s.size();
    for (int i=0; i<n; i++)
	{
       a[i+1]=s[i]-'0';
    }
    int l=1; 
    for (int i=n; i>=1; i--)
	{ 
       g[i]=l;
       l*=10;
       l%=2019;
    }
    for (int i=n; i>=1; i--)
	{
       f[i]=(f[i+1]+a[i]*g[i])%2019;
       k[f[i]]++;
    }
    sum=k[0];
    sum+=(k[0]*(k[0]-1)/2);
    for (int i=1; i<=2018; i++)
	{
       sum+=(k[i]*(k[i]-1)/2);
    }
    cout<<sum;
    return 0;
}

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

int main()
{
	int n;
	string str;
	while (cin >> n, n) {
		int dice[] = { 1, 2, 3, 4, 5, 6 };
		int cd[6];
		int res = dice[0];
		for (int i = 0; i < n; i++) {
			cin >> str;
			if (str == "North") {
				for (int j = 0; j < 6; j++) {
					cd[j] = dice[j];
				}
				dice[0] = cd[1];
				dice[1] = cd[5];
				dice[5] = cd[4];
				dice[4] = cd[0];
				res += dice[0];
			}
			else if (str == "East") {
				for (int j = 0; j < 6; j++) {
					cd[j] = dice[j];
				}
				dice[0] = cd[3];
				dice[3] = cd[5];
				dice[5] = cd[2];
				dice[2] = cd[0];
				res += dice[0];
			}
			else if (str == "West") {
				for (int j = 0; j < 6; j++) {
					cd[j] = dice[j];
				}
				dice[0] = cd[2];
				dice[2] = cd[5];
				dice[5] = cd[3];
				dice[3] = cd[0];
				res += dice[0];
			}
			else if (str == "South") {
				for (int j = 0; j < 6; j++) {
					cd[j] = dice[j];
				}
				dice[0] = cd[4];
				dice[4] = cd[5];
				dice[5] = cd[1];
				dice[1] = cd[0];
				res += dice[0];
			}
			else if (str == "Right") {
				for (int j = 0; j < 6; j++) {
					cd[j] = dice[j];
				}
				dice[1] = cd[2];
				dice[2] = cd[4];
				dice[4] = cd[3];
				dice[3] = cd[1];
				res += dice[0];
			}
			else {
				for (int j = 0; j < 6; j++) {
					cd[j] = dice[j];
				}
				dice[1] = cd[3];
				dice[3] = cd[4];
				dice[4] = cd[2];
				dice[2] = cd[1];
				res += dice[0];
			}
		}
		cout << res << endl;
	}
	return 0;
}

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

template <
    typename TYPE,
    std::size_t SIZE>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;
using vi = vector<ll>;

#define REPS(a, i, n) for (ll(i) = a; (i) < (n); ++(i))
#define REP(i, n) REPS(0, i, n)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 912345678;

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

    int ans = 0;
    REP(i, a + 1)
    {
        REP(j, b + 1)
        {
            REP(k, c + 1)
            {
                ans += i * 500 + j * 100 + k * 50 == x;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 1000000007
#define ll long long
using namespace std;
ll dp[1140][1140];
int ka[214514],inv[214514];
int invp[1140][1140];
int combb[1140][1140];
void setkaijo(int n){
	ka[0]=1;
	for(int i=1;i<=n;i++){
		ka[i] = ka[i-1] * i;
		ka[i] %= inf;
	}
}
int modpow(int x,int k){
	// x ^ k mod inf
	if(k==0)return 1;
	int p2[55],res=1;
	p2[0]=1;p2[1]=x%inf;
	for(int i=2;i<=50;i++){
		p2[i]=p2[i-1]*p2[i-1];
		p2[i] %= inf;
	}
	for(int i=1;i<=50;i++){
		if(k%2==1){
			res *= p2[i];
			res %= inf;
		}
		k /= 2;
	}
	return res;
}
void setinv(int n){
	inv[0]=1;
	for(int i=1;i<=n;i++){
		inv[i] = modpow(ka[i],(ll)inf-2);
	}
}
int comb(int n,int k){
	if(k==0 || k==n)return 1;
	int res = (ka[n] * inv[k]) % inf;
	res = (res*inv[n-k]) % inf;
	return res;
}
signed main(){
	ll n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	dp[0][0]=1;
	setkaijo(10000);
	setinv(10000);
	for(int i=0;i<a;i++){
		dp[i][0]=1;
	}
	for(int i=1;i<1100;i++){
		for(int j=0;j<1100;j++){
			invp[i][j] = modpow(inv[i],j);
			if(i>=j)combb[i][j] = comb(i,j);
		}
	}
	combb[0][0]=1;
	inv[0]=1;
	for(int i=a;i<=b;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=j/i;k++){
				if( k==0 || ( c<=k && k<=d) ){
				ll cur = dp[i-1][j-i*k];
				ll mul = combb[n-j+i*k][i*k];
				mul *= ka[i*k];
				mul %= inf;
				mul *= invp[i][k];
				mul %= inf;
				mul *= inv[k];
				mul %= inf;
				cur *= mul;
				cur %= inf;
				//cout<<i<<j<<" "<<cur<<" "<<mul<<endl;
				dp[i][j] += cur;
				dp[i][j] %= inf;
				}
			}
		}
	}
	cout<<dp[b][n]<<endl;
	return 0;
}

Measured memory_bytes: 32128
#include<iostream>
#include<cmath>
#include<stdio.h>

#define PI 3.141592654

using namespace std;

int main(void)
{
	double x = 0;
	double y = 0;
	int  step, d_angle;
	int  angle = 90;

	while(1)
	{
		scanf( "%d,%d",&step , &d_angle );
		if( step == 0 && d_angle == 0 ) break;

		x += step * cos((double)angle*PI/180);
		y += step * sin((double)angle*PI/180);

		angle -= d_angle;
	}

	cout << (int)x << endl << (int)y << endl;

	return 0;
}

Measured memory_bytes: 1212
#include <stdio.h>
#define N 100
int main(){
  int A[N];
  int i,j,n,minj,count=0,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    if(minj!=i){
      temp=A[i];
      A[i]=A[minj];
      A[minj]=temp;
      count++;
    }
  }
  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n",count);
  return 0;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(), k=sc.nextInt();
		final long mod = 1000000007;
		int[] array = new int[n];
		for(int i=0;i<n;i++) array[i]=sc.nextInt();
		sc.close();
		long count=0, temp=0;
		for(int i=0;i<n-1;i++) {
			for(int j=i+1;j<n;j++) {
				if(array[i]>array[j]) count++;
			}
		}
		count*=k;
		count%=mod;
		Arrays.sort(array);
		for(int i=0;i<n-1;i++) {
			for(int j=i+1;j<n;j++) {
				if(array[i]<array[j]) {
					temp++;
				}
			}
		}
		long sum2 = ((temp%mod) * ((((long)k * (long)(k-1))/2)%mod));
		long sum = (count+sum2)%mod;
		System.out.println(sum);
	}
}

Measured memory_bytes: 25940
n, m = map(int, input().split())
AB = []
for _ in range(m):
    a, b = map(int, input().split())
    AB.append([a,b])
AB = sorted(AB, key=lambda x:x[1])

rem = 0
now = 0

for ab in AB:
    left = ab[0]
    right = ab[1]
    if left <= now:
        pass
    else:
        now = right -1
        rem += 1

print(rem)



Measured memory_bytes: 22104
#include<iostream>

using namespace std;

int main()
{
	int n;
	int i,j,k;
	int page[55];
	
	for(;;)
	{
		cin >> n ;
		if(n==0)
			break;
		
		int ans[64]={0};
		for(i=0;i<n;i++)
		{
			cin >> page[i] ;
		}
		for(i=0,k=0;i<n;++i)
		{
			ans[k]=page[i];
			k++;
			for(j=i;j<n;j++)
			{
				if(page[j]+1!=page[j+1])
				{
					ans[k]=page[j];
					k++;
					i=j;
					break;
				}
			}
		}
		for(i=0;i<k;i+=2)
		{
			if(ans[i]!=ans[i+1] && ans[i+1]!=0)
			{
				cout << ans[i] << "-" << ans[i+1] ;
			}
			else
			{
				cout << ans[i] ;
			}
			if(i<k-2)
				cout << " "  ;
		}
		cout << endl;
	}
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;
	template<class T>using pair = std::pair<T, T>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
	
	template<class T>constexpr T pow(T val, std::uint64_t p)
	{
		auto ret = T(1);
		auto s = 1ULL;
		for (auto i = 0; i < 63; ++i, s <<= 1)
		{
			if (p & s)
			{
				ret *= val;
			}
			val *= val;
		}
		return ret;
	}
	template<class Range>void sort(Range& rng)
	{
		std::sort(std::begin(rng), std::end(rng));
	}
	template<class Range, class Pred>void sort(Range& rng, Pred pred)
	{
		std::sort(std::begin(rng), std::end(rng), pred);
	}
}

void Main()
{
	int D, T, S;
	std::cin >> D >> T >> S;
	std::cout << (D <= T * S ? "Yes" : "No") << std::endl;
}

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

Measured memory_bytes: 3608
#pragma GCC optimize("O3") 

#include <bits/stdc++.h>
using namespace std;

typedef long long int           ll;
typedef unsigned long long int  ull;
typedef long double             ld;

typedef pair<int, int>          pii;
typedef pair<ll,ll>             pll;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef vector<pii>             vpii;
typedef vector<pll>             vpll;

#define test(t)		        int t; cin >> t; while(t--)
#define f(i, a, b)	        for(int (i) = (a); (i) < (b); ++(i))
#define all(a)		        (a).begin(), (a).end()
#define endl 		        "\n"
#define maxvec(vec)             *max_element(all(vec))
#define minvec(vec)             *min_element(all(vec))
#define maxarr(arr)             *max_element(arr, arr + n)
#define minarr(arr)             *min_element(arr, arr + n)
#define deb(x)		        cout << #x << "--" << x << "--" << endl;
#define deb2(x,y)	        cout << #x << "-" << x << "-" << " ~~ " <<  #y << "-" << y << "-" << endl;
#define deba(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define debap(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n.first << "-" << n.second << " "; cout << "]" << endl;
#define fast 		        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L

void solve()
{
  string s, t;
  cin >> s >> t;
  ll n = s.length(), cnt = 0;
  f(i, 0, n)
    if(s[i] != t[i])
      cnt += 1;
  cout << cnt << endl;
}

int main()
{
    fast;
    //test(t)
        solve();
    return 0;
}

Measured memory_bytes: 3836
from collections import deque

S = input()
Q = int(input())

que = deque()

for s in S:
    que.append(s)

swi = 0
for _ in range(Q):
    query = input().split()

    if query[0] == "1":
        swi ^= 1
    else:
        if query[1] == "1":
            if swi == 0:
                que.appendleft(query[2])
            else:
                que.append(query[2])
        else:
            if swi == 0:
                que.append(query[2])
            else:
                que.appendleft(query[2])

if swi == 1:
    que.reverse()

print("".join(list(que)))


Measured memory_bytes: 8692
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int n;
	while(scanf("%d", &n)==1)
	{
		vi a(n+1);
		vi x(n+1);

		for(int i=2;i<=n;i++)
		{
			scanf("%d", &a[i]);
			x[a[i]]++;
		}

		for(int i=1;i<=n;i++) printf("%d\n", x[i]);
	}
	return 0;
}


Measured memory_bytes: 4364
from math import ceil, floor
N = int(input())
f = N / 1.08
f_c = ceil(f)
f_f = floor(f)

if floor(f_c *1.08) == N:
    print(f_c)
elif floor(f_f * 1.08) == N:
    print(f_f)
else:
    print(':(')

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

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

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  cin >> A;

  int gcd = 0;
  for(auto &p : A) gcd = __gcd(gcd, p);

  const int lim = 1000000;
  vector< int64 > y(lim + 1);
  for(auto &p : A) y[p]++;
  for(int i = 1; i <= lim; i++) {
    for(int j = i + i; j <= lim; j += i) {
      y[i] += y[j];
    }
    y[i] = 1LL * y[i] * (y[i] - 1) / 2;
  }
  for(int i = lim; i >= 1; i--) {
    for(int j = i + i; j <= lim; j += i) {
      y[i] -= y[j];
    }
  }
  if(y[1] == 1LL * N * (N - 1) / 2) cout << "pairwise coprime\n";
  else if(gcd == 1) cout << "setwise coprime\n";
  else cout << "not coprime\n";
}

Measured memory_bytes: 15072
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main()
{

  int n , m;
  cin >> n >> m;
  vector< pair< int , int > > v(m);
  for(int i = 0 ; i < m ; i++){
	int x ,y ;
    cin >> x >> y;
   	v[i] = {x , y};
  }
  int l = v[0].first;
  int r = v[0].second;
  for(int i = 1 ; i < m ; i++){
   	l = max(l , v[i].first);
    r = min(r , v[i].second);
  }
  if(r < l)
  	cout << 0 << endl;
  else
  cout << r - l + 1 << endl;
  return 0;
}

Measured memory_bytes: 1024
import math

a, b, C = map(float, input().split())

C = C * math.pi /180

S = a * b * math.sin(C) / 2
L = a + b + math.sqrt(a ** 2 + b ** 2
                             - 2 * a * b *math.cos(C))
h = 2 * S / a

print(S)
print(L)
print(h)


Measured memory_bytes: 5692
/**
*	created: 13.09.2020 21:04:45
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

signed main() {
    int n; cin >> n;
    n == 0 ? cout << 1 << endl : cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;


int main(void)
{
    int h,w;
    cin >> h >> w;
    
    vector<string> s(h);
    vector<vector<int>> cnt(h,vector<int>(w));
    
    for (int i = 0;i < h;i++)
    {
        cin >> s[i];
    }
    int dx[] = {0,1,1,1,0,-1,-1,-1};
    int dy[] = {-1,-1,0,1,1,1,0,-1};
    
    for (int y = 0;y < h;y++)
    {
        for (int x = 0;x < w;x++)
        {
            if (s[y][x] == '#')
            {
                cnt[y][x] = -1;
                
                for (int i = 0;i < 8;i++)
                {
                    int nx = x + dx[i],ny = y + dy[i];
                    if (nx < 0 || nx >= w) continue;
                    if (ny < 0 || ny >= h) continue;
                
                    if (s[ny][nx] == '.') cnt[ny][nx]++;
                }
            }
            
            
            
        }
    }
    
    for (int y = 0;y < h;y++)
    {
        for (int x = 0;x < w;x++)
        {
            if (cnt[y][x] == -1) cout << '#';
            else cout << cnt[y][x];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N = int(input())
b = [int(x) for x in input().split()]
ans = []
maker = 0
for i in range(N):
    if b[i] > i+1:
        maker = -1
        break
if maker < 0:
    print(-1)
else:     
    for i in range(N):
        for j in range(N-i):
            if b[j] == j + 1:
                x = j + 1
        ans.append(x)
        b.pop(x-1)

    for i in range(N):
        print(ans[-i-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
int main(){
	int n;
	cin>>n;
	vector<long long> a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a.begin(),a.end());
	if(a[0]==0){
		cout<<0<<endl;
		return 0;
	}
	long long ans=1,tmp;
	for(auto x : a){
		if(__builtin_mul_overflow(ans,x,&tmp)){
			cout<<-1<<endl;
			return 0;
		}
		ans = ans*x;
	}
	if(ans>1000000000000000000LL)
		cout<<-1<<endl;
	else
		cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4056