akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	string s; cin >> s;
    int n = s.size();
    rep(i, n) {
        if(i % 2 == 0) {
            if(s[i] == 'L') {
                cout << "No" << endl;
                return;
            }
        } else {
            if(s[i] == 'R') {
                cout << "No" << endl;
                return;
            }
        }
    }
    cout << "Yes" << endl;
    return;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll a,b,c,d,n;
int main(){
	cin >> n >> a >> b >> c >> d;

	b = b - a;

	REP(i,n) {
		//cout << (n - i - 1) * c - i * d  << " " <<  (n - i - 1) * d - i * c << endl;
		if((n - i - 1) * c - i * d <= b && (n - i - 1) * d - i * c >= b) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}


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

Measured memory_bytes: 256
#pragma region template 1.2
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a) \
    REP(i, (a).size()) { cout << (a[i]) << (i == (a).size() - 1 ? "\n" : " "); }
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    ll N;
    cin >> N;
    string S;
    cin >> S;

    vi r(N + 1), g(N + 1), b(N + 1);
    REP(i, N)
    {
        r[i + 1] = r[i];
        g[i + 1] = g[i];
        b[i + 1] = b[i];
        if (S[i] == 'R')
        {
            ++r[i + 1];
        }
        else if (S[i] == 'G')
        {
            ++g[i + 1];
        }
        else
        {
            ++b[i + 1];
        }
    }

    ll ans = 0;
    REP(i, N)
    {
        for (ll j = i + 1; j < N; ++j)
        {
            if (S[i] == 'R' and S[j] == 'G' or S[i] == 'G' and S[j] == 'R')
            {
                ans += b[N] - b[j + 1];
                if (2 * j - i < N and S[2 * j - i] == 'B')
                {
                    --ans;
                }
            }
            if (S[i] == 'G' and S[j] == 'B' or S[i] == 'B' and S[j] == 'G')
            {
                ans += r[N] - r[j + 1];
                if (2 * j - i < N and S[2 * j - i] == 'R')
                {
                    --ans;
                }
            }
            if (S[i] == 'R' and S[j] == 'B' or S[i] == 'B' and S[j] == 'R')
            {
                ans += g[N] - g[j + 1];
                if (2 * j - i < N and S[2 * j - i] == 'G')
                {
                    --ans;
                }
            }
        }
        // OUT(ans);
    }
    OUT(ans);
}


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

using namespace std;

int main(){
    int n;
    cin >> n;
    int ara[n+1];
    for(int i = 1;i<=n;i++){
        cin >> ara[i];
    }
    int q;
    cin >> q;
    while(q--){
        int a,b;
        cin >> a >> b;
        int z = 0;
        int temp = ara[a];
        ara[a] = b;
        for(int i = 1;i<=n;i++)z+=ara[i];
        cout << z << endl;
        ara[a]=temp;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> graph(N, vector<int>(N, 1));
    int a, b;
    rep(0, i, M)
    {
        cin >> a >> b;
        a--;
        b--;
        graph.at(a).at(b) = 0;
        graph.at(b).at(a) = 0;
    }
    vector<int> v(N);
    rep(0, i, N)
    {
        v.at(i) = i;
    }

    int ans = 0;
    do
    {
        if (v.at(0))
        {
            break;
        }
        bool flag = true;
        rep(0, i, N - 1)
        {
            if (graph.at(v.at(i)).at(v.at(i + 1)))
            {
                flag = false;
            }
        }
        if (flag)
        {
            ans++;
        }
    } while (next_permutation(all(v)));
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    string s; cin>>s;
    int n = s.size() , a = 0;
    string t="";
    rep(i,n){
        if(s[i] == 'A') {t+='X'; continue;}
        if(i!=n-1){
            if(s[i] == 'B' && s[i+1] == 'C') {t+= 'Y'; i+=1; continue;}
            t += s[i];
        }
    }
    
    string tmp = "";
    int ans = 0;
     n = t.size();
    for(int i=0;i<n;i++){
        if(t[i]=='X'||t[i]=='Y') tmp += t[i];
        if(i == n-1 || (t[i]=='B'|| t[i] == 'C')) {
            int x = tmp.size(), now = 0, cnt = 0;
            rep(j,x){
                if(tmp[j] == 'X') cnt++;
                else ans += cnt;
            }
            tmp = "";
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1032
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String s=sc.nextLine();
    sc.close();
    String str[]=new String[s.length()];
    boolean isDifferent=true;
    for(int i=0;i<s.length();i++){
      str[i]=s.substring(i,i+1);
    }
    Arrays.sort(str);
    for(int i=0;i<str.length-1;i++){
      if(str[i].equals(str[i+1])){
        isDifferent=false;
        break;
      }
    }
    if(isDifferent){
      System.out.println("yes");
    }else{
      System.out.println("no");
    }
  }
}

Measured memory_bytes: 23380
input_str = input()
n_orders = int(input())
for _ in range(n_orders):
    order_str = input()
    if order_str.startswith('print'):
        _, start, end = [s.strip() for s in order_str.split()]
        start = int(start)
        end = int(end) + 1
        print(input_str[start:end])
    elif order_str.startswith('reverse'):
        _, start, end = [s.strip() for s in order_str.split()]
        start = int(start)
        end = int(end) + 1
        rev_str = input_str[start:end]
        rev_str = list(reversed(rev_str))
        input_str = list(input_str)
        input_str[start:end] = rev_str
        input_str = ''.join(input_str)
    elif order_str.startswith('replace'):
        _, start, end, rep_str = [s.strip() for s in order_str.split()]
        start = int(start)
        end = int(end) + 1
        input_str = list(input_str)
        input_str[start:end] = rep_str
        input_str = ''.join(input_str)




Measured memory_bytes: 5636
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
  cin>>n;
  double a[n];for(int i=0;i<n;i++)cin>>a[i];
  double sum=0.0;
  for(int i=0;i<n;i++)
  {
  sum=sum+(1.0/a[i]);
  }
  cout<<setprecision(16)<<1.0/sum;
}

Measured memory_bytes: 256
x = int(input())

dp = [0] * (x + 1)
cost = [100, 101, 102, 103, 104, 105]

if x < 100:
    print('0')
elif x <= 105:
    print('1')
else:
    dp[0] = 1
    for _x in range(1, x + 1):
        for c in cost:
            if dp[_x - c] == 1:
                dp[_x] = 1
                continue

    if dp[-1]:
        print('1')
    else:
        print('0')


Measured memory_bytes: 3828
#include<stdio.h>
main()
{
  int i,j,n,q,cnt=0;
  int S[10000], T[500];

  scanf("%d",&n);
  for(i = 0; i < n; i++) {
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(j = 0; j < q; j++) {
    scanf("%d",&T[j]);
    for(i = 0; i < n; i++) {
      if(T[j] == S[i]) {
	cnt++;
	break;
      }
    }
  }
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 640
N = int(input())
a_list = list(map(int, input().split()))
dp = [0]*N

if 1 not in a_list:
    print(-1)
else:
    dp[0]= 1
    count = 0
    for i in range(N-1):
        if dp[i] == a_list[i]:
            dp[i + 1] = dp[i] + 1
        else:
            dp[i + 1] = dp[i]
            count += 1

    if dp[N-1] != a_list[N-1]:
        count += 1
        
    print(count)

Measured memory_bytes: 26268
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}
	static IntStream REPS(int l,int r) {
		return IntStream.rangeClosed(l,r);
	}
	static IntStream INS(int n) {
		return REPS(n).map(i->getInt());
	}
	static int getInt(){
		return Integer.parseInt(s.next());
	}
	public static void main(String[]__){
		int k=getInt(),t=getInt();
		HashMap<Integer,Integer> m=new HashMap<>();
		REPS(t).forEach(i->m.put(i,getInt()));
		
		int l=-1,c=0;
		for(int i=0;i<k;i++) {
			final int last=l;
			Optional<Integer> hoge=m.entrySet().stream()
					.filter(o->o.getKey()!=last&&o.getValue()!=0)
					.max(Entry.comparingByValue())
					.map(Entry::getKey);
			
			if(!hoge.isPresent())
				c++;
			m.merge((l=hoge.orElse(last)),-1,Integer::sum);
		}
		System.out.println(c);
	}
}


Measured memory_bytes: 28884
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main () {
    int N, tmp, min = 10000000;
    cin >> N;
    int a[N];
    int order[N];

    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < N; i++) {
        order[a[i] - 1] = i;
    }

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

Measured memory_bytes: 1536
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class A
{
	public static void Main()
	{
		string A = GetString();
		string B = GetString();
		string C = GetString();
		if(A[A.Length-1] != B[0])
			Console.WriteLine("NO");
		else if(B[B.Length-1] != C[0])
			Console.WriteLine("NO");
		else
			Console.WriteLine("YES");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 11092
let array_of_string s = Array.init (String.length s) (fun i -> s.[i])

let () =
  read_line ()
  |> array_of_string
  |> Array.to_list
  |> (fun (h :: t) ->
      List.fold_left (fun (b, prev) c -> (b || prev = 'A' && c = 'C', c)) (false, h) t)
  |> fst
  |> (function true -> "Yes" | false -> "No")
  |> print_endline

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int d, g;
	scanf("%d %d", &d, &g);
	int p[11], c[11];
	int i, j;
	for (i = 0; i < d; i++)
		scanf("%d %d", &p[i], &c[i]);
	int max = 1;
	for (i = 0; i < d; i++)
		max *= 2;
	int ans = 1000000009;
	int count, score, q;
	int a[11];
	for (i = 0; i < max; i++)
	{
		count = 0;
		score = 0;
		q = i;
		for (j = 0; j < d; j++)
		{
			a[j] = q % 2;
			q /= 2;
		}
		for (j = 0; j < d; j++)
		{
			if (a[j] == 1)
			{
				score += 100 * (j + 1) * p[j] + c[j];
				count += p[j];
			}
		}
		if (score < g)
		{
			for (j = d - 1; j >= 0; j--)
			{
				if (a[j] == 0)
				{
					if (100 * (j + 1) * p[j] + score < g)
					{
						score += 100 * (j + 1) * p[j];
						count += p[j];
					}
					else
					{
						count += (g - score + 100 * (j + 1) - 1) / (100 * (j + 1));
						score += 100 * (j + 1) * ((g - score + 100 * (j + 1) - 1) / (100 * (j + 1)));
						break;
					}
				}
			}
		}
		if (score >= g && ans > count)
			ans = count;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/
int main() {
    ll N;
    cin>>N;
    vi dp(N);
    ll x=0;
    REP(i,N){
        ll a;
        cin>>a;
        x+=a;
        dp[i]=x;
    }
    //REP(i,N)cout<<dp[i]<<" ";
    ans=INF;
    REP(i,N-1){
        ans=min(ans,llabs(dp[i]-(dp[N-1]-dp[i])));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;

void solve()
{
	int n,m; cin >> n >> m;
	vector<P> d(m);
	rep(i, m)
	{
		int s, c; cin >> s >> c;
		d[i] = {s,c};
	}
	rep(i, 1000)
	{
		string s = to_string(i);
		if(sz(s) == n)
		{
			bool ok = true;
			for(auto e : d)
			{
				if(s[e.first-1]!=char('0'+e.second))ok = false;
			}
			if(ok)
			{
				cout << s << endl;
				return;
			}
		}
	}
	cout << -1 << endl;
	return;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
 
int main() {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  
  if(U==S) A--;
  else B--;
  
  cout << A << " " << B << endl;
}

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

int main() {
    ll n,a[200],count=0;
    cin >> n;
    for(int i=0;i<n;i++) cin >> a[i];
    //bubble sort
    bool flag = true;
    while(flag){
        flag = false;
        for(int i=n-1;i>0;i--){
            if(a[i-1] > a[i]){
                swap(a[i-1], a[i]);
                flag = true;
                count++;
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << a[i];
        if(i != n-1) cout << " ";
        else cout << endl;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    int n;
    cin>>n;
    int m;
    cin>>m;
    int a1;
    ll ans = 0;
    for(int i=0;i<m;i++)
    {
        cin>>a1;
        ans += a1;
    }
    if(ans>n)
        cout<<"-1\n";
    else
        cout<<n-ans<<"\n";
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int z,y,x;
	int ans=0;
	cin >>x>>y>>z;
	cout<<z<<" "<<x<<" "<<y<<endl;
}

Measured memory_bytes: 3552
int main()
{
	int H,W,i,j;
	for(;scanf("%d%d",&H,&W),W;puts(""))
		for(i=0;i<H;i++)
			for(j=0;j<W;j++)
				printf("%c%s",i==0||i==H-1||j==0||j==W-1?'#':'.',j==W-1?"\n":"");
	return 0;
}

Measured memory_bytes: 612
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
#define X 1000000
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll u(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll d(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll z(ll a){
  if(a<0)return -a;
  return a;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
ll nCr(int n,int k){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (int i=2;i<X;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main(void){
  int a;
  scanf("%d",&a);
  FOR(100000){
    if(i*100<=a&&a<=i*105){
      PRN(1);
      return 0;
    }
  }
  PRN(0);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll N, S;
    cin >> N >> S;
    ll D = N-S;
    if(D < 0) {cout << -1 << endl; return 0;}
    if(D == 0) {cout << N+1 << endl; return 0;}
    vector<ll> ds;
    for(ll i = 1; i*i <= D; i++){
        if(D%i == 0) ds.pb(i), ds.pb(D/i);
    }
    ll ans = INF;
    for(auto &e: ds){
        ll tmp = 0, memo = N;
        e++;
        while(memo){
            tmp += memo%e, memo /= e;
        }
        if(tmp == S) chmin(ans, e);
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>

using namespace std;

bool is_second(int m, int t, int p) {
    if (m > t) {
        if (t > p)
            return true;
        else
            return false;
    } else {
        if (t < p)
            return true;
        else
            return false;
    }
    return false;
}

int main(int argc, char **argv) {
    int n;
    cin >> n;

    std::vector<int> p(n);
    for (int i=0; i<n; ++i) {
        cin >> p[i];
    }

    auto it_f = p.begin();
    auto it_b = it_f + 2;

    int ans{0};

    for (;it_b != p.end(); ++it_f, ++it_b) {
        if (is_second(*it_f, *(it_f+1), *it_b))
            ++ans;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int gcd(int,int);

int main(){
  int x, y;
  
  scanf("%d%d",&x,&y);

  printf("%d\n",gcd(x,y));

  return 0;
}

int gcd(int a, int b){
  int r;
  int tmp;
  if(a < b){
    tmp = b;
    b = a;
    a = tmp;
  }
  while(b > 0){
    r = a % b;
    a = b;
    b = r;
  }

  return a;
}



Measured memory_bytes: 2072
import java.util.*;
public class Main{

  static void findAns(long n,long ans,int count){

    if(n>1){
      ans+=Math.pow(2,count);
      ++count;
      findAns(n/2,ans,count);
    }
    else{
      ans+=Math.pow(2,count);
      System.out.println(ans);
    }
  }

  public static void main(String args[]){
    Scanner sc=new Scanner(System.in);
    long n=sc.nextLong();
    long ans=0;
    findAns(n,ans,0);
  }
}


Measured memory_bytes: 23636
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int w=sc.nextInt();
		int num[]=new int[w+1];
		for(int i=1;i<=w;i++){
			num[i]=i;
		}

		int n=sc.nextInt();
		for(int i=0;i<n;i++){
			String[] str=sc.next().split(",");
			int a=Integer.parseInt(str[0]);
			int b=Integer.parseInt(str[1]);
			int c=num[a];
			num[a]=num[b];
			num[b]=c;
		}

		for(int i=1;i<=w;i++){
			System.out.println(num[i]);
		}
		sc.close();
	}

}

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

using namespace std;

#define ll long long int
#define get(a) ll a; cin >> a;
#define show(a) cout << a << endl;
#define full(p) p.begin(), p.end()
#define sz(a) (ll)(a.size())
#define pb push_back

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(10);
	cout<<fixed;
	////////////////////////////////
	get(d);
    string ans = "";
    for(int i = 0 ; i< abs(d-25);i++ )
    	ans += " Eve";
	cout << "Christmas" << ans << endl;	

	return 0;
}

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

int main(){
  int a,b,c,x;
  cin>>a;
  cin>>b;
  cin>>c;
  cin>>x;
  int count = 0;
  for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
      for(int k=0;k<=c;k++){
        int sum=500*i+100*j+50*k;
        if(sum==x) count++;
      }
    }
  }
  cout<<count<<endl;
  return 0;
}
        
  
  

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stack>
#include<cmath>
#include<sstream>
using namespace std;

double StringToInt( string str )                                //String型からInt型へ変換する関数
{
    char zero = '0';                                            //ASCIIにおける文字としての1を整数としての1に変換する場合、'0'を引けばよい。
    double a = 0;
    double i, j;

    for( i = str.size() - 1, j = 0; i >= 0; i--, j++ )          //Strig型の1の位から順に、整数に変換していく
    {
        if( str[i] == '-')                                      //マイナスだった場合の処理
            a *= -1;
        else
            a += ( str[i] - zero ) * pow( 10, j );              
    }

    return a;
}

string IntToString( int num )                                   //Int型からString型に変換する関数
{                                                               //何故かto_stringが使えなかったので、代わりの処理。
    stringstream ss;
    ss << num;
    string str = ss.str();

    return str;
}

int main()
{
    string s;

    stack<string> st;

    while( cin >> s )
    {
        if( s == "+" )                               //ASCIIで43は+
        {
            double a = StringToInt( st.top() );
            st.pop();
            double b = StringToInt( st.top() );
            st.pop();
            st.push( IntToString(b+a) );
        }
        else if( s == "-" )                          //ASCIIで45は-
        {
            double a = StringToInt( st.top() );
            st.pop();
            double b = StringToInt( st.top() );
            st.pop();
            st.push( IntToString(b-a) );
        }
        else if( s == "*" )                          //ASCIIでは42が*
        {
            double a = StringToInt( st.top() );
            st.pop();
            double b = StringToInt( st.top() );
            st.pop();
            st.push( IntToString(b*a) );
        }
        else
            st.push( s );
    }

    cout << StringToInt( st.top() ) << endl;

    return 0;
}


Measured memory_bytes: 3432
a = int(input())
 
b=list(map(int, input().split())) 
x = 0
c = 0
    
for i in b:
  if ((i % 3 == 0) or (i % 5 == 0)) and (i % 2 == 0):
    x += 1

for t in b:
  if (t%2==0):
    c += 1;

if x == c:
  print('APPROVED')
else :
  print('DENIED')

Measured memory_bytes: 3064
#include<cstdio>
#include<algorithm>

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

using namespace std;

const int INF=1<<29;

int n;
char start[17],goal[17];

int dp[1<<16][16];
int dfs(int S,int p){
	if(S==(1<<n)-1) return 0;

	if(dp[S][p]!=-1) return dp[S][p];

	int res=INF;
	rep(i,n) if((S&1<<i)==0) rep(j,n) if((S&1<<j)==0 && i!=j && goal[i]!=goal[j]) {
		res=min(res,abs(p-i)+abs(i-j)+dfs(S|1<<i|1<<j,j));
	}
	return dp[S][p]=res;
}

int main(){
	for(;scanf("%d",&n),n;){
		scanf("%s%s",start,goal);
		rep(S,1<<n) rep(p,n) dp[S][p]=-1;

		int S=0;
		rep(i,n) if(start[i]==goal[i]) S|=1<<i;

		int ans=INF;
		rep(i,n) ans=min(ans,dfs(S,i));
		printf("%d\n",ans);
	}

	return 0;
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> plli;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>=0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()

const ll mod = 1e9 + 7;
const ll INF = 1<<30;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = 3.141592653589793;

int n,m;
int a[10];
string id;
ll dp[100000+5][10];

int trans(int num){
    if (num==5) return 1;
    if (num==6) return 3;
    if (num==7) return 5;
    if (num==8) return 7;
    if (num==9) return 9;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cin >> id;
    cin >> m;
    rep(i,m) cin >> a[i];
    dp[0][0]=1;
    reverse(all(id));
    rep(i,n){
        if (id[i]=='*'){
            rep(j,10){
                rep(k,m){
                    if ((i+1)%2==0){
                        if (a[k]>=5) dp[i+1][(j+(a[k]-5)*2+1)%10]+=dp[i][j];
                        else dp[i+1][(j+2*a[k])%10]+=dp[i][j];
                    }
                    else{
                        dp[i+1][(j+a[k])%10]+=dp[i][j];
                    }
                }
            }
        }
        else{
            rep(j,10){
                if ((i+1)%2==0){
                    if ((int)(id[i]-'0')>=5) dp[i+1][(j+((int)(id[i]-'0')-5)*2+1)%10]+=dp[i][j];
                    else dp[i+1][(j+2*(int)(id[i]-'0'))%10]+=dp[i][j];
                }
                else{
                    dp[i+1][(j+(int)(id[i])-'0')%10]+=dp[i][j];
                }
            }
        }
    }
    cout << dp[n][0] << endl;
    return 0;
}

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

void Main()
{
  int n; cin >> n; 
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int ans = 0;
  rep (i,n) {
 	if ((i+1)%2 == 1 and a[i]%2==1) ans++; 
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
map<string,int>mp;
int main() {
	int q;
	cin >> q;
	while (q--) {
		int Q;
		cin >> Q;
		string s, l, r;
		int x;
		switch (Q) {
		case 0:
			cin >> s >> x;
			mp[s] = x;
			break;
		case 1:
			cin >> s;
			cout << mp[s] << endl;
			break;
		case 2:
			cin >> s;
			mp.erase(s);
			break;
		case 3:
			cin >> l >> r;
			auto now = mp.lower_bound(l);
			auto end = mp.upper_bound(r);
			while (now != end) {
				if (now->second)cout << now->first << " " << now->second << endl;
				++now;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 27816
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(int i=1,i##_len=(n); i<=i##_len; ++i)
#define drep(i,n) for(int i=(n)-1; i>=0; --i)
#define srep(i,s,t) for(int i=(s);i<(t);++i)
#define rng(obj) (obj).begin(), (obj).end()
#define rrng(obj) (obj).rbegin(), (obj).rend()
#define maxs(x,y) (x=max((x),(y)))
#define mins(x,y) (x=min((x),(y)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T>>
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vp = vector<pii>;
template <class T> inline istream& operator>>(istream&i,v(T)&v)
{ rep(j,v.size())i>>v[j];return i;}
template <class T> string join(const v(T)&v)
{ stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template <class T> inline ostream& operator<<(ostream&o,const v(T)&v)
{ if(v.size())o<<join(v); return o;}
template <class T1,class T2> inline istream& operator>>(istream&i ,pair<T1,T2>&v)
{ return i>>v.fi>>v.se;}
template <class T1,class T2> inline ostream& operator<<(ostream&o ,pair<T1,T2>&v)
{ return o<<v.fi<<","<<v.se;}
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const double eps = 1e-10;
bool comp(pair<char,int> a,pair<char,int> b){
  return a.se<b.se;
}
//----------------------------------------------------------------
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}

#define fileio ifstream fio; if(argc>=2){fio.open(argv[1]); std::cin.rdbuf(fio.rdbuf());}
#define fastio ios_base::sync_with_stdio(false);
#define MOD 1000000007
//----------------------------------------------------------------
void Main(){
  int n;cin>>n;
  ll k;cin>>k;
  vl a(n);
  cin>>a;
  ll ngcd= a[0];
  rep(i,n){
    if(ngcd==1) break;
    ngcd = gcd(ngcd,a[i]);
  }
  if(k%ngcd==0 and k<=*max_element(rng(a))) cout<<"POSSIBLE"<<endl;
  else cout<<"IMPOSSIBLE"<<endl;
} int main(int argc,char* argv[]){ 
    fastio; fileio; Main();}

Measured memory_bytes: 1024
def abc065_c():
    from math import factorial
    n, m = map(int, input().split())
    if abs(n - m) >= 2:
        print(0)
    elif n == m:
        print((2 * factorial(n) * factorial(m)) % (10 ** 9 + 7))
    else:
        print((factorial(n) * factorial(m)) % (10 ** 9 + 7))


abc065_c()

Measured memory_bytes: 5184
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverseA(A.begin(),A.end());

typedef long long ll;

int main(){
  int N,K;
  cin >>N>>K;
  vector<int> H(N);
  rep(i,N) cin>>H[i];
  sort(H);
  ll ans = 0;
  rep(i,N-K) ans += H[i];
  cout << ans << endl;
}

Measured memory_bytes: 1024
from math import factorial

n = factorial(int(input()))
cnt = 2
k = 1
ans = 1

while n != 1:
    if n % cnt == 0:
        n //= cnt
        k = k + 1
    else:
        ans = ans * k
        k = 1
        cnt += 1
anw = (ans * k) % (10**9 + 7)
print(anw)

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  map<int,int> cnt;
  for (int i = 0, a; i < n; i++) {
    cin >> a;
    cnt[a]++;
  }
  vector<int> num;
  for (auto i : cnt) {
    num.emplace_back(i.second);
  }
  sort(num.begin(), num.end());
  int res = 0;
  for (int i = 0; i < (int) num.size() - k; i++) {
    res += num[i];
  }
  cout << res << '\n';
}

Measured memory_bytes: 10744
#include <iostream>

int main(int argc, char *argv[]) {
  std::string s;
  std::cin >> s;

  std::reverse(s.begin(), s.end());
  while (s.back() == 'S' && !s.empty())
    s.pop_back();

  int cnt = 0;
  for (int i = s.size() - 1; i >= 0; --i) {
    if (s.at(i) == 'R')
      cnt++;
    else
      break;
  }
  std::cout << cnt << std::endl;
}


Measured memory_bytes: 3192
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
using ll = long long;

int main() {

    int A, B;
    cin >> A >> B;


    for (int i = 0; i < 21; ++i) {
        if (1 + (A - 1) * i >= B) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}


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

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,k;
	cin >> n >> k;
	if ((n-1)*(n-2)/2 < k){
		cout << -1;
		return 0;
	}
	vector<pair<int,int>> v;
	int node=2,sum=(n-1)*(n-2)/2-k;
	for (int i=2; i<=n; ++i){
//		sum += i-2;
		node++;
		v.emplace_back(1,i);
	}
/*	while (sum < k){
		if (node > n){
			cout << -1;
			return 0;
		}
		v.emplace_back(2,node);
		sum++;
		node++;
	}
*/
	for (int i=2; i<=n; ++i){
		for (int j=i+1; j<=n; ++j){
			if (sum <= 0){
				break;
			}
			v.emplace_back(i,j);
			sum--;
		}
		if (sum <= 0) break;
	}
	cout << v.size() << '\n';
	for (auto& i:v){
		cout << i.first << ' ' << i.second << '\n';
	}
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int r,g,b,n;
	cin >> r >> g >> b >> n;
	int ans=0;
	for(int i=0; i<=n/r; i++){
		for(int j=0; j<=n/g; j++){
			if((n-r*i-g*j)>=0 && (n-r*i-g*j)%b==0){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>
    #include<cstdint>

    #define INF 1e7
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;

    int main(){
        int n,k;cin>>n>>k;
        double res = 0;
        REP(i,1,n){
            int cnt = 0,now = i;
            while(now<k){
                now *= 2;
              cnt++;
            }
          //cout<<now<<endl;
            res += pow(0.5,cnt);
        }
        res /= n;
        cout << fixed << setprecision(9);
        cout<<res;
    }
    


Measured memory_bytes: 256
/*
author: Apoorv Singh
*/

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

typedef vector <long long> vi;
typedef pair <long long, long long> pii;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " " << (x) << endl;
#define FOR(i, a, b) for (long long i = a; i < b; ++i)
#define FORR(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define int long long
#define inf LLONG_MAX

int modulo = 1e9 + 7;

template <class X>

void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}

int fpow(int a, int n)
{
    int ans = 1;
    while (n)
    {
        if (n&1)
            ans = (ans * a)%modulo;
        a = (a*a)%modulo;
        n = n >> 1;
    }
    return ans;
}

/*
const int M = 1e6 + 10;
int composite[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!composite[i])
        {
            for (int j = 2*i; j < M; j += i)
                composite[j] = max(composite[j], i);
        }
    }
}
*/

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b; cin >> a >> b;
    if (a >= 13)
    	cout << b << endl;
    else if (a >= 6) cout << b/2 << endl;
    else cout << 0 << endl;
    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 endl '\n'
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    char a,b;
    cin>>a>>b;
    if(a=='H')cout<<b<<endl;
    else{
        if(b=='H')cout<<'D'<<endl;
        else cout<<'H'<<endl;
    }
}

Measured memory_bytes: 256
while(True):
    val1 = input().split(" ")
    m,f,r = [int(i) for i in val1]
    
    if m == -1 and f == -1 and r == -1:
        break
    

    n = m + f
    
    if m == -1 or f == -1:
        print("F")
    elif n >= 80:
        print("A")
    elif n >= 65:
        print("B")
    elif n >= 50:
        print("C")
    elif n >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")



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

/*てんぷれぞーん！*/
//static const int INF = 2147483647;
static const int INF = 1000000000;
static const long long llINF = 9223372000000000000;
static const int NIL = -1;
static const int MOD = 1000000007;
typedef long long ll;
typedef pair<int,int> P;
struct edge {int to,cost;};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
/* t y p o っ て 知 っ て る ゥ ！ ？ */
#define itn int
#define scnaf scanf
#define reutnr return
/*必要に応じて使ってね*/
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
//#define int ll
//#define INF llINF
/*てんぷれぞーんしゅーりょー！*/

signed main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a%3==0 || b%3==0 || (a+b)%3==0) puts("Possible\n");
    else puts("Impossible\n");
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
const double PI = acos(-1);
int A, B, H, M;

int sqr(int x) { return x * x; }

void fastio() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
}

int main() {
  fastio();
  std::cin >> A >> B >> H >> M;
  double h = (H + M / 60.0) * 360 / 12;
  double m = M * 360 / 60;
  double theta = fabs(h - m) / 180.0 * PI;
  double C = sqrt(sqr(A) + sqr(B) - 2 * A * B * cos(theta));
  printf("%.9f\n", C);
  return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	ll n, a, b;
	cin >> n >> a >> b;
	ll res = a * (n / (a + b));
	n %= (a + b);
	n = min(a, n);
	if (n > 0) {
		res += n;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 3e18;
const int maxn = 1e5 + 10;
const ll mod = 1e9 + 7;
int n;
ll S[maxn], f[maxn][2], g[maxn], A, B, ans;
void cmod(ll & x)
{
	while(x < 0) x += mod;
	while(x >= mod) x -= mod;
}
int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> A >> B;
	if(A < B) swap(A, B);
	S[0] = -INF;
	S[n + 1] = INF;
	for(int i = 1; i <= n; ++i) cin >> S[i];
	f[0][0] = g[0] = 1;
	int L = 0, R = -1;
	for(int i = 1; i <= n; ++i) 
	{
		if(S[i] - S[i - 1] >= A) 
			f[i][0] = f[i - 1][0] + f[i - 1][1];
		cmod(f[i][0]);
		while(S[i] - S[R + 1] >= A && R + 1 < i - 1) ++R;
		//cout << i << ' ' << L << ' ' << R << endl;
		if(L <= R) f[i][1] = (R >= 0 ? g[R] : 0) - (L == 0 ? 0 : g[L - 1]);
		cmod(f[i][1]);
		g[i] = g[i - 1] + f[i][0];
		if(S[i + 1] - S[i - 1] >= B) g[i] += f[i][1];
		cmod(g[i]);
		if(S[i] - S[i - 1] < B) L = i - 1;
	}
	ans = g[n];
	for(int i = n; i; --i)
		if(S[i + 1] - S[i] < B)
		{
			ans = g[n] - g[i - 1];
			cmod(ans);
			break;
		}
	cout << ans << endl;
	return 0;
}

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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  int n;cin>>n;
  vector<int> arr(n),p(n),q(n);

  for(int i=0;i<n;i++)arr[i]=i+1;
  for(int i=0;i<n;i++)cin>>p[i];
  for(int i=0;i<n;i++)cin>>q[i];

  int a = 0, b = 0;;
  int cnt=1;
  do{
    if(arr==p)a=cnt;
    if(arr==q)b=cnt;
    cnt++;
  } while(next_permutation(arr.begin(), arr.end()));
  
  cout<<abs(a-b)<<endl;

  return 0;
}


Measured memory_bytes: 256
implicit none
integer(8) :: i,ans=0
character :: s1*16,s2*16
read*,s1
s2 = 'CODEFESTIVAL2016'
do i = 1,16
	if(s1(i:i)/=s2(i:i))then
		ans = ans+1
	endif
enddo
write(*,'(I0)')ans
end

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;

int main(){
    int l[N]={0},r[N]={0},n,k,c;
    string s;
    cin>>n>>k>>c>>s;
    for(int i=0,j=0;i<n;i++){
        if(s[i]=='o'){
            l[j++]=i;
            i+=c;
        }
    }
    for(int i=n-1,j=k-1;i>=0;i--){
        if(s[i]=='o'){
            r[j--]=i;
            i-=c;
        }
    }
    for(int i=0;i<k;i++){
        if(l[i]==r[i]) cout<<l[i]+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 3332