akhauriyash/Code-Regression huggingface dataset:
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    int N;
    cin >> N;
    long long pw = 1;
    for(int i = 1; i <= N; i++)
    {
        pw = (pw * i ) % 1000000007;
    }

    cout << pw << endl;
    
    return 0;
}


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

int main()
{
  int a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;
  vector<tuple<double,int,int>> vec;
  for(int i=1;i<30;i++){
    if(i*a*100>f) continue;
    for(int j=0;j<30;j++){
      if(i*a*100+j*b*100>f) continue;
      for(int k=0;k<120;k++){
        if(i*a*100+j*b*100+c*k>f) continue;
        if(e*(i*a+j*b)<c*k) continue;
        for(int l=0;l<120;l++){
          if(i*a*100+j*b*100+c*k+d*l>f) continue;
          if(e*(i*a+j*b)<c*k+d*l) continue;
          int water=i*a*100+j*b*100;
          int sugar=c*k+d*l;
          vec.push_back(make_tuple(100*(double)sugar/(sugar+water),water+sugar,sugar));
        }
      }
    }
  }
  sort(vec.begin(),vec.end());
  auto &first=get<1>(*(vec.end()-1)),&second=get<2>(*(vec.end()-1));
  cout<<first<<" "<<second;
}

Measured memory_bytes: 5872
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    if (k == 1) cout << 0 << endl;
    else cout << n-k << endl;
}


Measured memory_bytes: 3632
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
ll psum[200005] , ssum[200005];
signed main()
{
    fast;
  
    ll n,i,j;
    cin>>n;
    ll a[n+2];
    for(i=1;i<=n;i++)
    {
    	cin>>a[i];
    	psum[i] = psum[i-1] ^ a[i];
    }
    for(i=n;i>=1;i--)
    {
    	ssum[i] = ssum[i+1] ^ a[i];
    }
    for(i=1;i<=n;i++)
    {
    	ll ha = psum[i-1]^ ssum[i+1];
    	cout<<ha<<" ";
    }
}

Measured memory_bytes: 8320
import sys
sys.setrecursionlimit(150000)
def search(i, visited, ns) :
    #print(":", i+1)
    visited[i] = True
    for next, weight in ns[i]:
        if visited[next] == False:
            search(next, visited, ns)


def dfs(ns):
    visited = [False] * len(ns)
    ans = 0
    for i in range(len(ns)):
        if not visited[i]:
            #print(i+1)
            ans += 1
            search(i, visited, ns)
    return ans

def main():
    n,m = map(int,input().split())
    ns = [[] for _ in range(n)]
    for _ in range(m):
        (st,end,weight) = map(int,input().split())
        ns[st-1].append((end - 1,weight))
        ns[end-1].append((st-1,weight))
    ans = dfs(ns)
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 122920
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
static const int INF = 1000000007;
using ll = long long;
using namespace std;

int main() {
    vector<int> v(5, 0);
    string s = "MARCH";
    ll ans = 0;
    int n;
    cin >> n; cin.ignore();
    for (int i = 0; i < n; ++i) {
        char a[15];
        scanf("%s", a);
        for (int j = 0; j < 5; ++j) {
            if(s[j] == a[0]) v[j]++;
        }
    }
    vector<int> v2 = {0, 0, 1, 1, 1};
    do{
        ll a = 1;
        for (int i = 0; i < 5; ++i) {
            if(v2[i]){
                a *= v[i];
            }
        }
        ans += a;
    }while (next_permutation(v2.begin(), v2.end()));
    cout << ans << "\n";
    return 0;
}


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

int main() {
    ll n, x, ans=0;
    cin >> n >> x;
    vector<ll> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    if(a[0]>x){
        ans += a[0] - x;
        a[0] = x;
    }
  
    for(int i=1; i<n; i++){
        if(a[i] <= x-a[i-1]){
            continue;
        }
        ans += a[i] + a[i-1] - x;
        a[i] = x-a[i-1];
    }

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

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define len(x) ((int)(x).size())
#define fastio ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const ll LINF = 1e18;
const int INF = 1e9;
const int MOD = 1e9+7;

/// command for char arrays with spaces -> scanf(" %[^\n]", text);
 
////////////////////////// Solution starts below. //////////////////////////////

int main(){
	fastio;
	int n, k;
	cin >> n >> k;
	int ans = 0;
	vector<int> v(n);
	for(int& i : v){
		cin >> i;
		if(i >= k) ans++;
	}	
	cout << ans << endl;
	return 0;
}

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

using namespace std;

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

#define F first
#define S second

const int MAXN = 2e5 + 10;

int n, a[MAXN], b[MAXN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		if (a[i] > i){
			cout << "-1\n";
			return 0;
		}
	}
	ll ans = 0;
	for (int i = n-1; ~i; i--) {
		if (a[i] ^ b[i]){
			if (b[i] > a[i]){
				cout << "-1\n";
				return 0;
			}
			ans += a[i];
		}
		if (i && a[i])
			b[i-1] = a[i]-1;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const ll INF = ll(1e15)+10;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;

int main() {
	string S; cin >> S;
	int Q; cin >> Q;

	deque<char> X;
	rep(i, S.size()) {
		X.push_back(S[i]);
	}
	
	int cnt = 0;
	rep(i, Q) {
		int t; cin >> t;
		if (t == 1) cnt++;
		if (t == 2) {
			int f; char c; cin >> f >> c;
			int w = (f + cnt) % 2;
			if (w == 1) {
				X.push_front(c);
			}
			if (w == 0) {
				X.push_back(c);
			}
		}
	}

	int sz = X.size();
	if (cnt%2 == 0) {
		rep(i, sz) {
			cout << X[i];
		}
	}
	else {
		rep(i, sz) {
			cout << X[sz-i-1];
		}
	}

	cout << endl;
	return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,al,bo;
  al=0;
  bo=0;
  cin >> n;
vector<int> a(n);
  for(i=0;i<n;++i)
  {
  cin >> a.at(i);
  }
sort(a.begin(),a.end());
reverse(a.begin(),a.end());
  for(i=0;i<n;++i)
  {
  if(i%2==0) al=al+a.at(i);
  else bo=bo+a.at(i);
  }
cout << al-bo;
return 0;}

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

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  for(int i=0;i<n;i++) {
    cin >> a[i];
  }
  
  int s=0;
  for(int i=0;i<n;i++) {
    s+=a[i];
  }
  int cut = 0;
  for(int i=0;i<n;i++) {
    if(a[i]*(4*m)>=s) {
      cut++;
    }
    else {
    }
  }
  if(cut>=m) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}

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();
  if(a<b){
    if(b<c){
     System.out.printf("%d %d %d\n", a,b,c);
    }else if(a<c){
     System.out.printf("%d %d %d\n", a,c,b);
    }else{
      System.out.printf("%d %d %d\n", c,a,b);
    }
   }else{
     if(a<c){
     System.out.printf("%d %d %d\n", b,a,c);
    }else if(b<c){
     System.out.printf("%d %d %d\n", b,c,a);
    }else{
      System.out.printf("%d %d %d\n", c,b,a);
    }
  }
}
}

Measured memory_bytes: 26316
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
	    int x = stdIn.nextInt();
	    int a = stdIn.nextInt();
	    
	    if(x >= a){
	        System.out.println("10");
	    }else{
	        System.out.println("0");
	    }
        
    }
}


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

long long int n, s;

long long int ans;

long long int FUNC(long long int n, long long int b) {
	long long int c = 0;
	while (n > 0) {
		c += n%b;
		n=n / b;
	}
	return c;
}

int main(void) {


	cin >> n >> s;

	ans = 1000000000005;

	int R = (int) sqrt(n) + 1;
	for (int b = 2; b <= R; b++) {
		if (FUNC(n, b) == s) { ans = min(ans, (long long int) b); }
	}

	for (int i = R; i >= 1; i--) {
		long long int b = (n - s) / i + 1;
		if (b < 2) { continue; }
		if (FUNC(n, b) == s) { ans = min(ans, b); }
	}

	if (n == s) { ans = min(ans, n + 1); }

	if (ans > 1000000000000) { cout << -1 << endl; }
	else { cout << ans << endl; }

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#文字列の入力
s = input()
# 出力
#box1 = ["A", "T"]
#box2 = ["G", "C"]
if s =="A":
  print("T")
elif s=="T":
  print("A")
elif s == "C":
  print("G")
elif s == "G":
  print("C")

Measured memory_bytes: 2940
#include <utility>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#define REP(i,n) for(int i=0;i<n;i++)
typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll orig = N;
    ll divide = 1000000000;
    int sum = 0;
    for (; divide > 0; divide /=10){
        sum += N / divide;
        N = N % divide;
    }
    string ans;
    if (orig % sum == 0){
        ans = "Yes";
    }else{
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll A,B,C;
  ll f=0,s=0;
  cin>>A>>B>>C;
  if(A==5) f++;
  if(A==7) s++;
  if(B==5) f++;
  if(B==7) s++;
  if(C==5) f++;
  if(C==7) s++;
  if(s==1&&f==2) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    string s;
    cin >> s;
    int k, ans=0;
    for(int i=0; i<s.size(); i++){
        k = s[i]-'0';
        ans += k;
        ans %= 9;
    }

    if(ans%9==0){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 3724
import math
N, D = map(int, input().split())
a = []
ans = 0
for _ in range(N):
  tmp = list(map(int, input().split()))
  a.append(tmp)
for n in range(N):
  for m in range(n+1,N):
    dis = 0
    for d in range(D):
      dis += (a[n][d]-a[m][d])**2
    if math.sqrt(dis) == int(math.sqrt(dis)):
      ans += 1
print(ans)



Measured memory_bytes: 9120
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.*;
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(),x=sc.nextInt(),t=sc.nextInt();
        System.out.println((n+x-1)/x*t);



    }




    static void sort(int[] a) {
        ArrayList<Integer> l=new ArrayList<>();
        for (int i:a) l.add(i);
        Collections.sort(l);
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }
    static void sortReverse(long[] a) {
        ArrayList<Long> l=new ArrayList<>();
        for (long i:a) l.add(i);
//        Collections.sort.(l);
        Collections.sort(l,Collections.reverseOrder());
        for (int i=0; i<a.length; i++) a[i]=l.get(i);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}

Measured memory_bytes: 35812
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define  mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,m;cin>>n>>m;
    ll ans=0;
    ans=100*(n-m);
    ans+=1900*m;
    ll mm=m;
    while(mm--)
        ans*=2;
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include<stdio.h>
int main ()
{
    int n,d,x,z,i,a[200],q,j;
    scanf("%d%d%d",&n,&d,&x);
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
        q=a[i];
        for(j=1;j<=d;j+=q)
        {
            x++;
        }
    }
    printf("%d\n",x);
}


Measured memory_bytes: 128
N = int(input())
e = [0]*101

for n in range(2, N+1):
    cur = n
    for i in range(2, n+1):
        while cur%i==0:
            e[i]+=1
            cur //= i

ans = 0
ov74, ov24, ov14, ov4, ov2 = 0,0,0,0,0
for ei in e:
    if ei>=2: ov2 += 1
    if ei>=4: ov4 += 1
    if ei>=14: ov14 += 1
    if ei>=24: ov24 += 1
    if ei>=74: ov74 += 1

ans += ov24*(ov2-1)
ans += ov4*(ov4-1)*(ov2-2)//2
ans += ov14*(ov4-1)
ans += ov74
# print(e)
print(ans)

Measured memory_bytes: 3064
import java.util.*;
 
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();
    boolean flag = false;
 
    for(int i = 1; i <= b; i++){
      if(a * i % b == c){
        flag = true;
        break;
      }
    }
 
    if(flag == true){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }
 
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    string s; cin >> s;
    int n = s.size();
    rep(i,n){
        for(int j=i+1;j<n;j++){
            if(s[i]=='C' && s[j]=='F'){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


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

using namespace std;
const double eps = 1e-9;
const int INF = (int)1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector <int> a(n + 1);
    int ans = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    for (int i = 1; i < n; ++i) {
        if (a[i] == i && a[i + 1] == i + 1) {
            swap(a[i], a[i + 1]);
            ans++;
        }
    }

    for (int i = 1; i <= n && n > 1; ++i) {
        if (i == 1 && a[i] == 1) {
            swap(a[i], a[i + 1]);
            ans++;
        } else if (i == n && a[i] == i) {
            swap(a[i], a[i - 1]);
            ans++;
        } else {
            if (a[i] == i) {
                swap(a[i], a[i - 1]);
                ans++;
            }
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 640
import java.math.BigInteger; 
import java.util.Scanner;
import java.util.Arrays;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		BigInteger[] A = new BigInteger[N];
		BigInteger comp = new BigInteger("1000000000000000000");
		for(int i=0;i<N;i++)
		{
		    A[i]=sc.nextBigInteger();
		}
		Arrays.sort(A); 
		BigInteger ans = A[0];
		for(int i=1;i<N;i++)
		{
		    ans = ans.multiply(A[i]);
		    if(ans.compareTo(comp)>0 || ans.equals(0))
		    {
		        break;
		    }
		}
		if(ans.compareTo(comp)>0)
		{
		   System.out.println(-1);
		}
		else{
		    System.out.println(ans);
		}
	}
}


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

int main() {
  string N;
  cin >> N;
  if (N[0] == '7' || N[1] == '7' || N[2] == '7') {
    cout << "Yes" << endl;
    }
  else {
    cout << "No" << endl;

  }

}



Measured memory_bytes: 3588
N, T = map(int, input().split())

i = []
for _ in range(N):
    c, t = map(int, input().split())
    i.append([c,t])

cmin = 1001
for n in range(N):    
    if i[n][1] <= T and i[n][0] < cmin:
        cmin = i[n][0]

if cmin == 1001:
    print('TLE')
else:
    print(cmin)

Measured memory_bytes: 38384
while True:
	h, w = map(int, input().split())
	if h == 0 and w == 0:
		break
	for i in range(h):
		for j in range(w):
			if i == 0 or i == h - 1 or j == 0 or j == w - 1:
				print('#', end = '')
			else:
				print('.', end = '')
		print()
	print()


Measured memory_bytes: 7004
// {{{ Headers
// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}}

#include <cassert>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#include <fstream>
#include <iostream>
#include <sstream>

using namespace std;
// }}}

typedef long long int64;
const int INF = 0x3f3f3f3f;
template <class T> inline int len (const T &a) { return a.size (); }
#define ALL(x) (x).begin(), (x).end()

const int MX = 3005;
long double v [MX];
long double dp [MX][MX];

int
main () {
    int N;

    scanf ("%d", &N);
    for (int i = 0; i < N; i++) scanf ("%Lf", v + i);

    dp [0][0] = 1.0;
    for (int i = 1; i <= N; i++)
        for (int j = 0; j <= N; j++) {
            dp [i][j + 1] += dp [i - 1][j] * v [i - 1];
            dp [i][j] += dp [i - 1][j] * (1 - v [i - 1]);
        }

    long double ret = 0.0;
    for (int i = (N + 1) / 2; i <= N; i++)
        ret += dp [N][i];

    printf ("%0.20Lf\n", ret);

#ifdef LOCALHOST
	cerr << "time: " << (int64) clock () * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0;
}



Measured memory_bytes: 141184
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n;
int arr[200005];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	rep(x,0,n) cin>>arr[x];
	
	int curr=0;
	ll ans=0;
	
	if (arr[0]!=0){
		cout<<"-1"<<endl;
		return 0;
	}
	
	rep(x,0,n){
		if (curr+1<arr[x]){
			cout<<"-1"<<endl;
			return 0;
		}
		else if (curr+1==arr[x]){
			ans++;
		}
		else{
			ans+=arr[x];
		}
		curr=arr[x];
	}
	
	cout<<ans<<endl;
}


Measured memory_bytes: 4448
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  int count = 0;
  for(int i=0;i<=a;i++){
   for(int j=0;j<=a;j++){
    if (i+j>b) break;
    if(i+j+a>=b){
      count++;
    }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3620
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const N  = parseInt(arg[0].split(" ")[0]);
    const Q  = arg[0].split(" ")[1];
    const S  = arg[1];

    let totalSum = new Array(N).fill(0);
    let cnt = 0;
    
    for(let i in totalSum) {
        if(S[i] === "A" && S[parseInt(i)+1] === "C") {
            cnt++;
        }
        
        totalSum[parseInt(i)+1] = cnt;
    }

    for(let i=0; i<Q; i++) {
        let lr = arg[i+2].split(" ");
        let l = lr[0];
        let r = lr[1];
        
        console.log(totalSum[r-1]-totalSum[l-1]);
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 40104
#include <iostream>
#include <algorithm>
#include <cstdio>

using namespace std;

const int N = 2e5 + 100;

struct person
{
    int d, cs, dis = -1;
    bool operator < (const person &b) const {return d < b.d;}
} p[N];
struct rwork
{
    int s, t, x;
    bool operator < (const rwork &b) const {return x < b.x;}
} w[N];
int n, q, fnext[N];

int found_down(int k) // first >=
{
    if (p[q-1].d < k) return q;
    int l = 0, r = q-1, res;
    while (l <= r) {
        int mid = (l+r)/2;
        if (p[mid].d >= k) res = mid, r = mid - 1;
        else l = mid + 1;
    } return res;
}

int found_up(int k) // last <=
{
    if (p[0].d > k) return -1;
    int l = 0, r = q-1, res;
    while (l <= r) {
        int mid = (l+r)/2;
        if (p[mid].d <= k) res = mid, l = mid + 1;
        else r = mid - 1;
    } return res;
}

int Update(int j, int e)
{
    if (fnext[j] != -1 && j <= e) return fnext[j] = Update(fnext[j], e);
    return j;
}

void Create_Mark()
{
    fill(fnext, fnext + N, -1);
    for (int i = 0; i < n; ++i) {
        int b = found_down(w[i].s - w[i].x), e = found_up(w[i].t - 1 - w[i].x);
        int j = b, tmp;
        while (j <= e) {
            j = Update(j, e);
            if (j > e) break;
            p[j].dis = w[i].x, fnext[j] = e + 1, ++j;
        }
    }
}

bool cmp (const person &a, const person &b) {return a.cs < b.cs;}

int main()
{
//    freopen("ROADWORK.INP", "r", stdin);
//    freopen("ROADWORK.OUT", "w", stdout);

    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; ++i) scanf("%d%d%d", &w[i].s, &w[i].t, &w[i].x);
    for (int i = 0; i < q; ++i) {scanf("%d", &p[i].d); p[i].cs = i;}
    sort(w, w + n), sort(p, p + q);

    Create_Mark();
    sort(p, p + q, cmp);
    for (int i = 0; i < q; ++i) printf("%d\n", p[i].dis);

    return 0;
}


Measured memory_bytes: 7296
"""
author : halo2halo
date : 24,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

n, a = map(int, readline().rstrip().split())


print(int((n+a+1)/2) if (n+a) % 2 == 1 else int((n+a)/2))


Measured memory_bytes: 3060
S = input()
flg = 0
if S[0] == 'A':
    flg += 1
if S[1].isupper():
    flg += 1000
for i in range(2, len(S)-1):
    if S[i] == 'C':
        flg += 10
    elif S[i].isupper():
        flg += 1000
if S[-1].isupper():
    flg += 1000
if flg == 11:
    print('AC')
else:
    print('WA')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int sub = 0;
  
  cin >> N;
  vector<int> v(N);
  for(int i = 0; i < N; i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  for(int j = 0; j < N; j++){
    if(j %2 == 0){
      sub += v[j];
    }
    else{
      sub -= v[j];
    }
  }
  cout << sub << endl;
}

Measured memory_bytes: 256
/*      ###########################
        #  Author : Pranay Garg   #
        #  College : SGSITS       #
        ###########################
*/      
#include<bits/stdc++.h>
#define ll long long int
#define ironman ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MOD 1000000007  
#define endl '\n'
#define INF 1e18L+1
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
using namespace std;
template<class T> T max(T a, T b, T c) {
    return max(a, max(b, c));
}
template<class T> T min(T a, T b, T c) {
    return min(a, min(b, c));
}
void fastio()
{
    ironman
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
            freopen("error.txt","w",stderr);
    #endif
}
bool prime[100005];
void SieveOfEratosthenes(ll n)//O(nloglogn) 
{  
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (ll i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}  
bool isPrime(ll n)//O(sqrt(n))
{
    if(n<2)
        return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
std::vector<ll> factors(ll n)//O(sqrt(n))
{
    std::vector<ll> f;
    for(ll i=2;i*i<=n;i++)
    {
        while(n%i==0)
        {
            f.push_back(i);
            n = n/i;
        }
    }
    if(n>1) f.push_back(n);
    return f;
}
ll gcd(ll a,ll b)//O(logn)
{
    if(!b) return a;
    return gcd(b,a%b);
}
ll modpow(ll x,ll n,ll m)//O(logn)// used for calculating (x^n)%m
{
    if(n==0) return 1%m;
    ll u = modpow(x,n/2,m);
    u = (u%m * u%m)%m;
    if(n%2==1)
        u = (u%m * x%m)%m;
    return u%m;
}
ll eulerstotientfunction(ll n)//O(sqrt(n))
{
    ll ans = n;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
                n = n/i;
            ans -= ans/i;
        }
    }
    if(n>1)
        ans -= ans/n;
    return ans;
}
ll modinverse(ll x,ll m)//O(logn)
{
    ll temp = eulerstotientfunction(m);
    return modpow(x,temp-1,m);
}
ll ncr(ll n,ll k)
{
    ll res = 1;
    k = min(k,n-k);
    for(ll i=0;i<k;i++)
    {
        res *= (n-i);
        res /= (i+1);
    }
    return res;
}
int main()
{
    //fastio();
    ll n;
    cin >> n;
    std::vector<string> arr(n);
    unordered_map<string,ll> mp;
    for(ll i=0;i<n;i++)
    {
        cin >> arr[i];
        sort(arr[i].begin(),arr[i].end());
        mp[arr[i]]++;
    }
    ll ans = 0;
    for(auto it:mp)
    {
        ans += it.se*(it.se-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 17700
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        
        int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int N = a[0];
        int i = a[1];
        
        int num = N - i + 1;
        Console.WriteLine(num);
        
    }
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

int main() {
    li a, b, c;
    cin >> a >> b >> c;
    if (a == b)cout << c << endl;
    else if (a == c)cout << b << endl;
    else cout << a << endl;

    return 0;
}

Measured memory_bytes: 256
A,B,C = map(int,input().split())

if A == B == C: 
  print(-1 if A%2==0 else 0)
else:
  c = 0
  while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    ba = A
    bb = B
    bc = C
    A = (bb + bc)//2
    B = (ba + bc)//2
    C = (ba + bb)//2
    c+=1
  print(c)


Measured memory_bytes: 9120
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

void solve(vector<string> const &rows) {
  stack<tuple<int,int>> stk;
  for (auto &&row : rows) {
    int const level = row.length() - 1;
    char const cmd = row.back();
    if (isdigit(cmd)) {
      stk.emplace(level, cmd-'0');
    } else if (cmd == '+') {
      int sum = 0;
      while (!stk.empty() && get<0>(stk.top()) == level + 1) {
        sum += get<1>(stk.top());
        stk.pop();
      }
      stk.emplace(level, sum);
    } else {
      assert(cmd == '*');
      int product = 1;
      while (!stk.empty() && get<0>(stk.top()) == level + 1) {
        product *= get<1>(stk.top());
        stk.pop();
      }
      stk.emplace(level, product);
    }
  }
  cout << get<1>(stk.top()) << endl;
}

int main() {
  // cout << fixed << setprecision(10);
  int n;
  while (cin >> n && n > 0) {
    vector<string> rows;
    REP(i, n) {
      string row; cin >> row;
      rows.push_back(row);
    }
    reverse(begin(rows), end(rows));
    solve(rows);
  }
  return 0;
}



Measured memory_bytes: 3216
n = int(input())
a = list(map(int, input().split()))
ruiseki = 0
count = 0
for i in range(n-1):
    ruiseki += a[i]
    count += ruiseki * a[i+1]
mod = 10**9 + 7
if count >= mod:
    print(count%mod)
else:
    print(count)

Measured memory_bytes: 31616
#include <stdio.h>
#include <stdlib.h>

int main(void) {
    int np;

    scanf("%d", &np);

    int seqp[np];

    for(int i = 0; i < np; i++) {
        scanf("%d", &seqp[i]);
    }

    int nremove = 0;
    int min = seqp[0];
    for(int i = 0; i < np; i++) {
        if(seqp[i] > min) {
            nremove++;
            continue;
        }

        if(min > seqp[i])
            min = seqp[i];

        if(seqp[i] > min) {
            nremove++;
        }
    }

    printf("%d\n", np - nremove); 
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <set>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

int main(void){
    int n;
    cin >> n;
    int a[n];
    REP(i,n) cin >> a[i];

    ll sum = 0;
    REP(i,n-1){
        if(a[i] > a[i+1]){
            sum += (a[i]-a[i+1]);
            a[i+1] = a[i];
        }
    }
    cout << sum << endl;
    
    return 0;
}

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

int main(){
    int ans=0;
    string a="CODEFESTIVAL2016";
    string s;
    cin>>s;
    for(int i=0;i<16;++i){
        if(s[i]!=a[i]){
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int a, b, c;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> a >> b >> c;
    int ans = min(abs(b-a)+abs(c-a), abs(a-b)+abs(c-b));
    ans = min(ans, abs(a-c)+abs(b-c));
    cout << ans << endl;
    return 0;
}


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

const int64_t inf = 1e18;

signed main () {
    int n, m;
    cin >> n >> m;
    vector < int64_t > x(n), y(n), z(n);
    for (int i = 0; i < n; ++i)
        cin >> x[i] >> y[i] >> z[i];
    int64_t ans = 0;
    for (int mask = 0; mask < 8; ++mask) {
        vector < int64_t > prior(n, 0);
        for (int i = 0; i < n; ++i) {
            prior[i] = x[i] + y[i] + z[i];
            if (mask & (1 << 0))
                prior[i] -= 2 * x[i];
            if (mask & (1 << 1))
                prior[i] -= 2 * y[i];
            if (mask & (1 << 2))
                prior[i] -= 2 * z[i];
        }
        sort(prior.rbegin(), prior.rend());
        int64_t here = 0;
        for (int i = 0; i < m; ++i)
            here += prior[i];
        ans = max(ans, here);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define REP(i,n) for (int i = 0; i < n; ++ i)
#define FOR(i,a,b) for (int i = a; i <= b; ++ i)
#define FORD(i,b,a) for (int i = b; i >= a; -- i)
#define debug(x) cerr << #x << ": " << x << "\n"
#define task ""
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> li;
typedef vector<int> vi;

void update(int a, int &tmp) {

}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	//freopen(task".inp", "r", stdin);
	//freopen(task".out", "w", stdout);
	int a[3], res;
	REP(i, 3) cin >> a[i];
	res = 10000;
	FOR(x, -1, 51) {
		int tmp = 0;
		REP(i, 3) {
			if (x < a[i]) tmp += a[i] - x;
			else if (x > a[i]) tmp += (x - a[i] + 1) / 2 + (x - a[i]) % 2; 
		}
		res = min(res, tmp);
	} 	
	cout << res;
}


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

int main() {
  int N;
  cin >> N;
  int o = 0;  // bobutoarisukimeru
  int l = 0; // -1
  int MAX = 0;
  int a = 0;
  int b = 0;
  vector<int> vec(N);
  for (int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  for (int p = 0; p < N; p++){
    MAX = 0;
    for (int i = 0; i < N; i++){
      if (MAX <= vec.at(i)){
        MAX = vec.at(i);
        l = i;
      }
    }
    vec.at(l) = -1;
    if (o % 2  == 0){
      a += MAX;
      o++;
    }else{
      b += MAX;
      o++;
    }
  }
  cout << a- b << endl;
}

Measured memory_bytes: 3616
var lines = [];
var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output:process.stdout
});

rl.on('line',function(x){
  lines.push(x);
});

rl.on('close',function(){
  var n = Number(lines[0]);
  var ab = [];
  var result = 0;

  for(var i=1;i<=n;i++){
    tmp = lines[i].split(" ");
    ab[i] = {
      a: Number(tmp[0]),
      b: Number(tmp[1])
    }
    ab[i].wa = ab[i].a + ab[i].b
  }
  ab.sort(function(a,b){ return b.wa-a.wa; });

  for(var i=0;i<n;i++){
      result += (i%2==0) ? ab[i].a : -ab[i].b
  }

  console.log(result);
//  console.log(a_result-b_result);

});


Measured memory_bytes: 54228
#include <algorithm>
#include <iostream>
#include <set>
#include <utility>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  vector<int> b;
  for (int i = 1; i < n; i++)
    if (a[i] > a[i - 1])
      b.push_back(1);
    else if (a[i] < a[i - 1])
      b.push_back(-1);
  long long ans = 1;
  for (int i = 1; i < b.size(); i++) {
    if (b[i] * b[i - 1] < 0) {
      ans++;
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1660
int main()
{
    long long n,k;
    int count=0;
    scanf("%lli%lli",&n,&k);
    long long h[n];
    for (int i=0;i<n;i++) {
        scanf("%lli",&h[i]);
        if (h[i]>=k) {
            count++;
        }
    }
    printf("%i",count);
    return 0;
}

Measured memory_bytes: 2424
///----> bismillahir rahmanir rahim <---- -- { ^ _ ^ }
///     { ^_^ }   { ^ _ ^ }
#include<bits/stdc++.h>
#include<bits/stdc++.h>
using namespace std;

//<--------------------------------------------typo section--------------------------------------------->
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;
typedef priority_queue<int>piwi;
typedef queue<int>kiwi;
typedef map<int,int>mi;
typedef map<string,int>mis;
typedef multimap<int,int>muli;
typedef multimap<string,int>muls;
typedef multiset<int>si;

//<----------------------------------------------------Narcos----------------------------------------------->
#define endl "\n"
#define Y cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
#define sp " "
#define PB push_back
#define F first
#define S second
#define as(a) (a).begin(),(a).end()
#define ras(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()
#define ki 1LL
#define MOD 1000000007
#define over return 0;
#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))
#define test int t;cin>>t;while(t--)


//<-----------------------------------------------------Const--------------------------------------------------->
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;


//<--------------------------------------------------------------------------------------------------->
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {            cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

const long long MAX_SIZE = 1000001; vector<long long >isprime(MAX_SIZE , true); vector<long long >prime; vector<long long >SPF(MAX_SIZE); void manipulated_seive(int N) { isprime[0] = isprime[1] = false ; for (long long int i=2; i<N ; i++) { if (isprime[i]) { prime.push_back(i); SPF[i] = i; } for(int j=0;j < (int)prime.size() && i*prime[j] < N && prime[j] <= SPF[i]; j++) { isprime[i*prime[j]]=false; SPF[i*prime[j]] = prime[j] ; } } }
int man_seive(int n){ manipulated_seive(n); for(int i=0;i<prime.size() && prime[i]<=n;i++)
cout<<prime[i]<<endl;
}
ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }

//continue;

//-----------------------------> YOUR JOURNEY STARTS HERE ------------------------------------>>

int main(){
    optimize();

    int n,m;
    cin>>n>>m;

    ll ans=1;
    for(int i=0;i<n;i++){
        ans*=100;
    }
    if(m<=99)
    cout<<ans*m<<endl;
    else{
        cout<<ans*101<<endl;
    }





over
}

Measured memory_bytes: 18632
S1=input()
T1=input()
S=""
T=""
A=""
for i in range(1,len(S1)+1):
    S+=S1[-i]
for i in range(1,len(T1)+1):
    T+=T1[-i]
j=0
i=0
flag = False
while i<=len(S)+1-len(T):
    while j<=len(T)+1:
        if i==len(S)-len(T)+1:
            A="UNRESTORABLE"
            flag=True
            break
        elif j==len(T):
            P=S.replace(S[i:i+len(T)],T,1)
            Q=P.replace("?","a")
            for i in range(1,len(Q)+1):
                A+=Q[-i]
            flag=True
            break
        elif S[i+j]==T[j] or S[i+j]=="?":
            j+=1
        else:
            j=0
            i+=1
    if flag:
        break
print(A)

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

int n, m, a, b;
map<int, int> mp;
string ans = "IMPOSSIBLE";

int main() {
    scanf("%d%d", &n, &m);
    while(m--) {
    	scanf("%d%d", &a, &b);
    	if(a == 1) mp[b]++;
    	if(b == n) mp[a]++;
    	if(mp[a] == 2 || mp[b] == 2) ans = "POSSIBLE";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

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

map<int, int> f(int n){
    
    map<int, int> ret;
    for(int i = 2; i * i <= n; i++){
        while(n % i == 0){
            ret[i]++;
            n /= i;
        }
    }

    if(n > 1) ret[n]++;

    return ret;
}

signed main(){
    
    int p, q; cin >> p >> q;
    int g = gcd(p, q);
    p /= g;
    q /= g;

    map<int, int> m = f(q);
    int b = 1;
    for(auto x : m){
        b *= x.first;
    }
    cout << b << endl;
    return 0;
}




Measured memory_bytes: 3120