akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

const int INF = 1e9;

int main() {
  int a,b,c,x,y;
  cin>>a>>b>>c>>x>>y;
  int ans=a*x+b*y;
  int an=x;
  int bn=y;
  for(int i=1;i<=max(x,y)*2;i++){
    int tmp=ans+2*c;
    if(an>0){
      tmp-=a;
      --an;
    }
    if(bn>0){
      tmp-=b;
      --bn;
    }
    if(tmp<ans){
      ans=tmp;
    }else{
      break;
    }
    if(an==0&&bn==0){
      break;
    }
  }
  cout<<ans<<endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

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

	string s;
	cin >> s;
	vector<string> A={"A","KIH","A","B","A","R","A"};
	FOR(i,0,(1<<4)){
		string p;
		FOR(j,0,7){
			if(A[j]!="A"){
				p = p+A[j]; 
			}else{
				if(i&(1<<(j/2)))p = p+'A';
			}
		}
		if(p==s){
			cout << "YES" << endl;
			return 0;
		}
	}
	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 n = sc.nextInt();

		int divideCount=0;
		for (int i=0; i<n; i++){
			int a = sc.nextInt();
			while (a % 2 ==0){
				a = a / 2;
				divideCount++;
			}
		}
		System.out.println(divideCount);
	}
}


Measured memory_bytes: 34180
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    
    long int n,h,w,ans=0,i,ab[1000][2];
    cin>>n>>h>>w;
    
    for(i=0;i<n;i++){
        for(int j=0;j<2;j++){
            cin>>ab[i][j];
        }
    }
    
    for(i=0;i<n;i++){
        if(ab[i][0] >= h && ab[i][1] >= w)
            ans++;
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdint>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    set<char> se;
    rep(i, 3) { se.insert(S[i]); }
    if(se.size() == 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
        }
    return 0;
}

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

string s;

int main(){

    cin >> s;
    for (int i = 0; 3 > i; i++){
        if (s[i] == s[i+1]){
            cout << "Bad\n";
            return 0;
        }
    }
    cout << "Good\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n;
    cin >> n;
    
    if (n > 999)cout << "ABD" << endl;
    else cout << "ABC" << endl;
    
    return 0;
}



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

int main() {
    string s; cin >> s;
    int n = s.size();
    int ans = 0;
    for (int i = 0; i < n/2; i++) {
        if (s[i] != s[n-1-i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];

    auto Comb = new Combination(100000);

    foreach (i; 1..K+1) {
        long x = Comb.comb(N-K+1, i);
        long y = Comb.comb(K-1, i -1);
        writeln(x * y % MOD);
    }
}

class Combination {
    long[] modinv;
    long[] f_mod;
    long[] f_modinv;

    this(int size) {
        modinv = new long[](size);
        modinv[0] = modinv[1] = 1;
        foreach(i; 2..size) {
            modinv[i] = modinv[MOD.to!int % i] * (MOD - MOD / i) % MOD;
        }

        f_mod = new long[](size);
        f_modinv = new long[](size);
        f_mod[0] = f_mod[1] = 1;
        f_modinv[0] = f_modinv[1] = 1;

        foreach(i; 2..size) {
            f_mod[i] = (i * f_mod[i-1]) % MOD;
            f_modinv[i] = (modinv[i] * f_modinv[i-1]) % MOD;
        }
    }

    long comb(long n, long k) {
        if (n < k) return 0;
        return f_mod[n.to!int] * f_modinv[(n-k).to!int] % MOD * f_modinv[k.to!int] % MOD;
    }
}

long powmod(long a, long x, long m) {
    long ret = 1;
    while (x) {
        if (x % 2) ret = ret * a % m;
        a = a * a % m;
        x /= 2;
    }
    return ret;
}

Measured memory_bytes: 4220
#include <iostream>
#include <vector>
#include <climits>
using namespace std;

int main() {
  int N, M;

  while (cin >> N >> M) {
    vector<int> D(N), C(M);

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

    vector<vector<int> > dp(N + 1, vector<int>(M + 1, INT_MAX));
    dp[0][0] = 0;

    for (int i = 0; i < N; i++) { // テ、ツサツ甘」ツ??」ツつ凝ゥツδステ・ツクツ?
      for (int j = 0; j < M; j++) { // テ、ツスツ陛ヲツ猟・テァツ崢ョ
        if (dp[i][j] == INT_MAX) continue;

        // テヲツャツ。テ」ツ?ョテゥツδステ・ツクツづ」ツ?クテゥツ?イテ」ツつ?
        int cost = dp[i][j] + D[i] * C[j];
        dp[i + 1][j + 1] = min(dp[i + 1][j + 1], cost);

        // テ、ツサツ甘」ツ?ョテゥツδステ・ツクツづ」ツ?ァテ・ツセツ?ヲツゥツ?
        dp[i][j + 1] = min(dp[i][j + 1], dp[i][j]);
      }
    }

    int ans = INT_MAX;
    for (int j = 0; j <= M; j++) { // Challenge: Mテ」ツ?セテ」ツ?ァテ」ツδォテ」ツδシテ」ツδ療」ツ?療」ツ?ヲテ」ツ?ェテ」ツ?凝」ツ?」テ」ツ??
      ans = min(ans, dp[N][j]);
    }
    cout << ans << endl;
  }
}

/*
テ」ツδ?」ツδ。
- テ」ツつオテ」ツδウテ」ツδ療」ツδォテ・ツ青暗」ツ?」テ」ツ?ヲテ」ツ?ェテ」ツ??」ツ?ョテ」ツ?ォテヲツ渉静・ツ?コテ」ツ?療」ツ??
 */

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

int main(){

    while(1){
        int t,n;
        cin >> t >> n;
        if(t==0&&n==0){
            break;
        }
        int dx[]={0,1,1,0,-1,-1};
        int dy[]={1,1,0,-1,-1,0};
        int gen=100;
        vector<vector<int>> m(201,vector<int>(201,-1));
        for(int i=0;i<n;i++){
            int tx,ty;
            cin >> tx >> ty;
            tx+=gen;
            ty+=gen;
            m[ty][tx]=100000;
        }
        int stx,sty;
        cin >> stx >> sty;
        stx+=gen;
        sty+=gen;
        m[sty][stx]=0;
        queue<pair<int,int>> q;
        q.push({sty,stx});
        int ans=0;
        while(q.size()!=0){
            pair<int,int> now=q.front();
            q.pop();
            for(int i=0;i<6;i++){
                int ny=now.first+dy[i];
                int nx=now.second+dx[i];
                if(0<=nx&&nx<201&&0<=ny&&ny<201){
                    if(m[ny][nx]==-1){
                        m[ny][nx]=m[now.first][now.second]+1;
                        q.push({ny,nx});
                    }
                }
            }
        }
        for(int i=0;i<201;i++){
            for(int j=0;j<201;j++){
                if(m[i][j]<=t&&m[i][j]!=-1){
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3280
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
str s;
ll K, n, dp[310][310][310];

int main(){
	IOS;
	cin >> s;
	cin >> K;
	ll n = s.size();
	if (n == 1) return cout << 1, 0;
	s = "." + s;
	//cout << n << '\n';
	for (int i = 1; i <= n; i++){
		dp[i][i + 1][0] = 1;
	}
	for (int i = 2; i <= n; i++){
		for (int j = 1; j <= n - i + 1; j++){
			for (int k = 0; k <= K; k++){
				if (k == 0){
					if (s[j] == s[j + i - 1]){
						dp[j][i + j][0] = dp[j + 1][i + j - 1][0] + 2;
					}
					dp[j][i + j][k] = max(dp[j][i + j][k], max(dp[j + 1][i + j][k], dp[j][i + j - 1][k]));
					
				}
				
				
				
				else if (k >= i - 1){
					dp[j][i + j][k] = i;
				}else{
					dp[j][i + j][k] = dp[j][i + j][k - 1];
					if (s[j] == s[i + j - 1]){
						dp[j][i + j][k] = dp[j + 1][i + j - 1][k] + 2;
					}
					dp[j][i + j][k] = max(dp[j][i + j][k], max(dp[j + 1][i + j][k], dp[j][i + j - 1][k]));
					dp[j][i + j][k] = max(dp[j][i + j][k], 2 + dp[j + 1][i + j - 1][k - 1]);
				}
				//cout << j << ' ' << j + i - 1 << ' ' << k << ' ' << dp[j][j + i][k] << '\n';	
			}
			
			
			
		}
		
		
	}
	cout << dp[1][n + 1][K];
	
	
	
	return 0;
}


Measured memory_bytes: 226816
N=int(input())
A=list(map(int, input().split())) 

ans = 'APPROVED'
for i in A:
  if i%2==0:
    #print(i)
    #print(i%3, i%5)
    if i%3==0 or i%5==0:
      ans = 'APPROVED'
    else:
      ans = 'DENIED'
      break

print(ans)

Measured memory_bytes: 3060
import os
import os
import sys
from collections import defaultdict

from scipy.misc import comb

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

S = sys.stdin.readline().rstrip()
N = len(S)


def test(S):
    s = {S}
    for l in range(len(S)):
        for r in range(l + 1, len(S)):
            s.add(S[:l] + S[l:r + 1][::-1] + S[r + 1:])
    return len(s)


ans = comb(len(S), 2, exact=True) + 1
counts = defaultdict(int)
for i, c in enumerate(S):
    # i より左にあるやつと c を選ぶと、その間の文字列を反転したのと同じになる
    ans -= counts[c]
    counts[c] += 1
print(ans)

# print(test(S))


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

int ans = 0;
vector < vector < int > > g(9);

void brute (int u, vector < bool > &used) {
    used[u] = 1;
    for (int v: g[u]) {
        if (!used[v]) {
            brute(v, used);
            used[v] = 0;
        }
    }
    if (count(used.begin(), used.end(), 0) == 1)
        ++ans;
}

signed main () {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    vector < bool > used(n + 1, 0);
    brute(1, used);
    cout << ans << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String args[]){

		Scanner sc = new Scanner (System.in);
		int x=sc.nextInt();
		for (int i=1;x!=0;++i){
			System.out.println("Case "+i+": "+x);
			x=sc.nextInt();
		}

	}
}


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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    ll ans = 0;
    ans += (X / 500) * 1000LL;
    X %= 500;
    ans += (X / 5) * 5LL;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n,a,b,c,d,p;
	while(scanf("%d",&n) != EOF){
		p = 0;
		for (a = 0;a <= 9;a++){
			for (b = 0;b <= 9;b++){
				for (c = 0;c <= 9;c++){
					for (d = 0;d <= 9;d++){
						if (n == a + b + c + d){
							p++;
						}
					}
				}
			}
		}
		printf("%d\n",p);
	}
	return 0;
}

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

vector<int> v;
int n;

int main(){
    scanf ("%d",&n);
    v.resize(n);
    for (int i= 0; n> i; i++){
        if (i) scanf (" ");
        else scanf ("\n");
        scanf ("%d",&v[i]);
    }
    sort(v.begin(),v.end());
    printf ("%d",v[n/2]-v[n/2-1]);
}


Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	var table [501][501]int
	var C [501][501]int

	var N, M, Q int
	fmt.Scan(&N, &M, &Q)
	for i := 0; i < M; i++ {
		sc.Scan()
		l, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		r, _ := strconv.Atoi(sc.Text())
		table[l][r]++
	}
	for i := 1; i <= N; i++ {
		C[i][1] = table[i][1]
		for j := 2; j <= N; j++ {
			C[i][j] = C[i][j-1] + table[i][j]
		}
	}
	w := bufio.NewWriter(os.Stdout)
	for i := 0; i < Q; i++ {
		sc.Scan()
		p, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		q, _ := strconv.Atoi(sc.Text())

		ans := 0
		for j := p; j <= q; j++ {
			ans += C[j][q] - C[j][p-1]
		}
		fmt.Fprintln(w, ans)
	}
	w.Flush()
}


Measured memory_bytes: 8740
#include <iostream>
#include <sstream>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <limits>
#include <iomanip>
#include <functional>
#include <array>
#include <climits>
#include <cmath>

using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;

int main()
{
    int N;
    cin >> N;
    ll sum = 0;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        while ((a & 1) == 0)
        {
            a >>= 1;
            sum++;
        }
    }
    cout << sum;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
  int N,L;
  cin >> N >> L;
  vector <string> v(N);
  
  for(int i = 0;i < N;i++) cin >> v[i];
  sort(v.begin(),v.end());
  
  for(int i = 0;i < N;i++) cout << v[i];
}


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

#define ll long long int
#define ld long double
#define pb push_back
#define pq priority_queue
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vvll vector<vector<ll>>
#define vvi vector<vector<int>>
#define vi vector<int>
#define vll vector<ll>
#define MODNUM 1000000007
#define lp(i,a,b) for(ll i=a; i<b; i++)

using namespace std;

ll mex(ll a, ll b, ll m) {
	if(b==0) return 1;
	if(b%2) return a*mex((a*a)%m,(b-1)/2,m)%m;
	else return mex((a*a)%m,b/2,m);
}

int x,y;
void exteu(ll a, ll m) {
	if(m==0) { x=1;y=0; }
	else {
		exteu(m,a%m);
		ll temp = x;
		x=y;
		y=temp-(a/m)*y;
	}
}

ll fact(ll n) 
{	ll prod=1;
	for(ll i=2; i<=n; i++) {
		prod*=i;
	}
	return prod;
}

ll gcd(ll a, ll b) {
	if(b==0) return a;
	return gcd(b, a%b);
}
// 2 2 2 7
// 2 2 2 3 3
// 3 3 7

// 3
// 2 
// 3 3
bool isprime[200001];
void makesieve() {
	memset(isprime, true, sizeof(isprime));
	for (int i = 2; i <= sqrt(200000); ++i)
	{
		/* code */
		if(isprime[i]) {
			for (int j = i*i; j <= 200000; j+=i)
			{
				/* code */
				isprime[j]=false;
			}
		}
	}
}
// 1001100110011001
void solve() {
	ll a, b; cin>>a>>b; cout<<a*b<<endl;
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll TESTS=1;
	// cin >> TESTS;
	// makesieve();
	while(TESTS--) {
		solve();
	}
	return 0;
}


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

#define int long long
#define double long double
#define incin(n) int (n); cin >> (n)
#define uniq(v) sort((v).begin(),(v).end()); (v).erase(unique((v).begin(),(v).end()),(v).end());
#define steprap(i,n,s) for(int (i)=0;i<(s)*(n);(i)+=(s))
#define rap(i,n) steprap((i),(n),1)

using intV = std::vector<int>;

using namespace std;
namespace math
{
	double PI = 3.14159265359;
	int step(int n);
	int ncr(int n,int r);
	int npr(int n,int r);
	int gcm(int a,int b);
	int lcm(int a,int b);

	int step(int n){
		if(n<=1){
			return 1;
		}else{
			return n * step(n-1);
		}
	}
	int ncr(int n,int r){
		for(int i=1;i<r;i++){
			n *= n-i;
		}
		for(int i=1;i<r;i++){
			r *= r-1;
		}
		return n/r;
	}
	int npr(int n,int r){
		for (int i = 1; i < r; ++i)
		{
			n *= n-1;
		}
		return n;
	}
	int gcm(int a,int b){
		int p=max(a,b);
		int q=min(a,b);
		int r;
		while(true){
			if(p%q==0){
				return q;
			}
			r = p%q;
			p=q;
			q=r;
		}
	}
}

using namespace std;
// using StringMap = std::vector<std::vector<char>> map(h+2,vector<char>(w+2,'#'));
namespace tmp {
    template <typename T> bool inArry(T x,vector<T> v);
    template <typename T> void input(int n,vector<T> &v);

    template <typename T> bool inArry(T x,vector<T> v){
        int l = v.size();
        for(int i=0;i<l;i++){
            if(x==v[i]){
                return true;
            }
        }
        return false;
    }
    
    template <typename T> void input(int n,vector<T> &v){
        for(int i=0;i<n;i++){
            cin >> v.at(i);
        }
    }
}

using namespace std;

signed main (){
	incin(n);
	cout<<(1+n)*n/2<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)

int main(){
 
 
  ll a,b;
  cin>>a>>b;
  ll ans=b*10;
  rep(i,10){
      if((ans+i)*8/100==a){
          cout<<ans+i<<endl;
          return 0;
      }
  }
 
  cout<<-1<<endl;
}



Measured memory_bytes: 3648
from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    S = stdin.readline().rstrip()
    spam1 = [0]
    for x in S[:-1]:
        spam1 += [spam1[-1] + 1 if x == 'W' else spam1[-1]]
    spam2 = [0]
    for x in S[::-1][:-1]:
        spam2 += [spam2[-1] + 1 if x == 'E' else spam2[-1]]
    spam2 = spam2[::-1]
    print(min([spam1[i] + spam2[i] for i in range(N)]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 30800
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  int ans; cin >> ans;
  REP(i, n - 1) {
    int a; cin >> a;
    ans = __gcd(ans, a);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef int64_t ll;
using namespace std;
 
int main() {
  int n;
  cin >> n;
 
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
 
  ll op = 0LL;
  ll sum = 0LL;
 
  // 奇数番目が正
  for (int i = 0; i < n; i++) {
    sum += a[i];
 
    if (i % 2 == 0 && sum <= 0) {
      op += 1 - sum;
      sum = 1;
    }

    else if (i % 2 == 1 && sum >= 0) {
      op += sum + 1;
      sum = -1;
    }
  }
 
  ll op_m = op;//今回の結果をop_mに格納


  sum = 0LL;
  op = 0LL;

  // 偶数番目が正
  for (int i = 0; i < n; i++) {
    sum += a[i];
 
    if (i % 2 == 1 && sum <= 0) {
      op += 1 - sum;
      sum = 1;
    }
    
    else if (i % 2 == 0 && sum >= 0) {
      op += sum + 1;
      sum = -1;
    }
  }
 
  op = min(op, op_m);
  cout << op << endl;
  return 0;
}

Measured memory_bytes: 1024
// finish date: 2018/01/21
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define bigmod 1000000007
#define INF 500000000


int main() {
    string S;
    cin >> S;
    vector<int> alpha(26, 0);
    rep(i, S.length()) alpha[S[i] - 'a'] = 1;
    rep(i, alpha.size()) {
        if (alpha[i] == 0) {
            cout << (char) ('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


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

void disp(const vector<int>& a){
  for(int i = 0; i < a.size(); i++){
    if(i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  if(prev_permutation(a.begin(), a.end())){
    disp(a);
  }
  next_permutation(a.begin(), a.end());
  disp(a);
  if(next_permutation(a.begin(), a.end())){
    disp(a);
  }
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double w,h,x,y;
	cin>>w>>h>>x>>y;
	if(w/2==x&&h/2==y)
	{
		cout<<w*h/2<<" "<<1<<endl;
	}
	else
	{
		cout<<w*h/2<<" "<<0<<endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define P(x) cout << x << endl
#define D(x) P(#x << ": " << x)
#define F(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEC(i,n) for(int i = (int)(n); --i >= 0;)
#define S(s) (int)((s).size())
#define ALL(v) v.begin(), v.end()
#define V vector
#define pb push_back
#define mt make_tuple
using namespace std;

struct xy { int x,y; };
bool xcomp(xy a, xy b) {
	return make_pair(a.x,a.y) < make_pair(b.x,b.y);
}

signed main() {
	xy p1,p2; cin >> p1.x >> p1.y >> p2.x >> p2.y;
	if(p1.x > p2.x) swap(p1,p2);
	int ymin = min(p1.y,p2.y), ymax = max(p1.y,p2.y);
	int n; cin >> n;
	V<xy> f;
	int m = 0;
	F(i,n) {
		xy p; cin >> p.x >> p.y;
		if(p.x >= p1.x && p.x <= p2.x && p.y >= ymin && p.y <= ymax) {
			f.push_back(p);
			++m;
		}
	}

	if(p2.y < p1.y) {
		F(i,m) f[i].y = -f[i].y;
	}

	sort(ALL(f),xcomp);

	int L[m];
	int lis = 0;
	F(i,m) {
		int pos = lower_bound(L,L+lis,f[i].y)-L;
		L[pos] = f[i].y;
		if(pos+1 > lis) {
			lis = pos+1;
		}
	}

	int dx = p2.x-p1.x, dy = ymax-ymin;

	double ans = 100*(dx + dy) - lis*(2*10-10*M_PI/2);

	if(lis == dx+1 || lis == dy+1) {
		ans -= 10*M_PI/2;
		ans += 10*M_PI;
	}

	printf("%.15lf\n",ans);
}

Measured memory_bytes: 6512
#include <bits/stdc++.h>
using namespace std;
int n,ans,f[1000005],g[1000005];
char S[1000005];
int main(){
	scanf("%d",&n);
	scanf("%s",S+1);
	for (int i=1;i<=n;++i) f[i]=f[i-1]+(S[i]=='W');
	for (int i=n;i;--i) g[i]=g[i+1]+(S[i]=='E');
	ans=n+5;
	for (int i=1;i<=n;++i){
		ans=min(ans,f[i-1]+g[i+1]);
	}
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
typedef long long int ll;

int n;
ll x;
ll sum=0;
ll a[51],p[51];
void dfs(int n,ll rest){
    if(rest<=1)return;
    rest--;
    if(rest>=a[n-1]){
        sum+=p[n-1];
        rest-=a[n-1];
    }
    else{
        dfs(n-1,rest);
        rest=0;
    }
    if(rest<=0)return;
    rest--;
    sum++;
    if(rest>=a[n-1]){
        sum+=p[n-1];
        rest-=a[n-1];
    }
    else{
        dfs(n-1,rest);
        rest=0;
    }
    if(rest<=0)return;
}

int main(){
    cin >> n >> x;
    a[0]=1;
    p[0]=1;
    for(int i=1;i<=50;i++){
        a[i]=a[i-1]*2+3;
        p[i]=p[i-1]*2+1;
    }
    dfs(n,x);
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    string s; cin >> s;
    int ans = 1e9;
    for(int i = 0; i < s.size() - 2; i ++){
        int n = (int)(s[i] - '0')*100 + (int)(s[i+1] - '0')*10 + (int)(s[i+2] - '0');
        ans = min(abs(753 - n), ans);
    }
    cout << ans << endl;
}

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

int main()
{
    int n, out, a;
    cin >> n;
    rep(i,3){
        a = n%10;
        if (a==7){
            cout << "Yes" << endl;
            return 0;
        }
        n/=10;
    }
    cout << "No" << endl;
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

const int INF=1001001001001001001;

int N,K;
int H[333];

int dp[333][333];

signed main(){
	cin>>N>>K;
	rep(i,N)cin>>H[i+1];
	fill_n(*dp,333*333,INF);
	dp[0][0]=0;
	rep(i,N)rep(j,K+1){
		for(int k=i+1;k<=N&&j+(k-i-1)<=K;k++){
			int tmp=max(H[k]-H[i],0ll);
			chmin(dp[k][j+(k-i-1)],dp[i][j]+tmp);
		}
	}

	int ans=INF;
	rep(i,N+1)rep(j,K+1){
		if(j+(N-i)<=K)chmin(ans,dp[i][j]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<cmath>
#define ll long long
using namespace std;
ll n;
ll a[100010];
ll dis[100010];
int main()
{
    ll sum=0;
    scanf("%lld",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        sum+=a[i];
    }
    ll k;
    if((2*sum%(n*(n+1)))!=0)
    {
        printf("NO");
        return 0;
    }
    k=2*sum/n/(n+1);
    for(int i=0;i<n;i++)
    {
        if(i==n-1)
            dis[i]=a[i]-a[0];
        else
            dis[i]=a[i]-a[i+1];
    }
    for(int i=0;i<n;i++)
    {
        if(dis[i]+k<0||(dis[i]+k)%n!=0)
        {
            printf("NO");
            return 0;
        }
    }
    printf("YES");
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long int ll;

int main()
{
    int N, M; cin >> N >> M;
    vector<int> v[1000007];
    for (int i=0; i<N; i++) {
        int A, B; cin >> A >> B;
      	v[A].push_back(B);
    }
  
    int ans = 0;
    priority_queue<int> pq;
    for (int i=1; i<=M; i++)
    {
        for (auto e : v[i]) pq.push(e);
   		if (! pq.empty()) {
          ans += pq.top();
          pq.pop();
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 26752
import sys

INF = 10e17
N = int(input())
A = list(map(int, sys.stdin.readline().rstrip().split()))
ans = 1
for a in A:
    if a == 0:
        print(0)
        sys.exit()
for a in A:
    ans = ans*a
    if ans > INF:
        print(-1)
        sys.exit()

print(ans)

Measured memory_bytes: 21736
#include <bits/stdc++.h>
using namespace std;
int tab[100000];
int main(){
    ios::sync_with_stdio(false);

    int nb;
    cin >> nb;
    for(int i = 0; i < nb; i++){
        int temp;
        cin >> temp;
        tab[temp]++;
        if(temp-1 >= 0) tab[temp-1]++;
        if(temp+1 < 100000) tab[temp+1]++;
    }
    int maxi = 0;
    for(int i = 0; i < 100000; i++){
        maxi = max(maxi, tab[i]);
    }
    cout << maxi << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
	public static void main (String[] args)  {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = sc.next().toCharArray();
		char[][] mixed = new char[4][n];
		mixed[0][0] = 'W';
		mixed[0][1] = 'W';
		mixed[1][0] = 'W';
		mixed[1][1] = 'S';
		mixed[2][0] = 'S';
		mixed[2][1] = 'W';
		mixed[3][0] = 'S';
		mixed[3][1] = 'S';
		for (int i = 0; i < 4; i++) {
			for (int j = 2; j < n; j++) {
				if (mixed[i][j - 2] == 'S' ^ mixed[i][j - 1] == 'S' ^ arr[j - 1] == 'o') {
					mixed[i][j] = 'S';
				} else {
					mixed[i][j] = 'W';
				}
			}
			if ((mixed[i][n - 1] == 'S' ^ mixed[i][0] == 'S' ^ arr[0] == 'o' ^ mixed[i][1] == 'W') && 
				(mixed[i][n - 2] == 'S' ^ mixed[i][n - 1] == 'S' ^ arr[n - 1] == 'o' ^ mixed[i][0] == 'W')) {
				System.out.println(mixed[i]);
				return;
			}
		}
		System.out.println(-1);
	}
}


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

int main(){
    ll n,k;
    cin >> n >> k;
    n %= k;
    ll c = abs(n - k);
    cout << min(c,n) << endl;
}

Measured memory_bytes: 3620
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String input = scanner.nextLine();
        String[] numbers = input.split(" ");

        int num = Integer.parseInt(numbers[0]);
        int base = Integer.parseInt(numbers[1]);

        double answer = Math.ceil(Math.log((double) num)/Math.log(base));

        if (Math.log((double) num)/Math.log(base) == (int) Math.log((double) num)/Math.log(base)) {
            System.out.println((int)answer + 1);
        } else {
            System.out.println((int)answer);
        }

    }

}

Measured memory_bytes: 23764
//
//  main.cpp
//  ervb
//
//  Created by Kanak Gautam on 21/04/20.
//  Copyright © 2020 Kanak Gautam. All rights reserved.
//
 
 
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#define pb push_back
#define mk make_pair
#define endl "\n"
#define mod 1000000007
using namespace std;
typedef long long int lli;
typedef long double ld;
priority_queue <lli, vector<lli>, greater<lli> > ti;
vector <ld> p[300005],f(200005,0),b(200005,0),a(200005,0);
map <pair<lli,lli>,lli> mp;
set<pair<lli, lli> > s;
set<lli> st;
map<lli,lli> np,v;
queue<lli> q;
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
lli bpow(lli a, lli b) {
    lli res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%mod;
        a = (a * a)%mod;
        b >>= 1;
    }
    return res%mod;
}
/*lli fact(lli i)
{
    f[0]=1;
    for(lli k=1;k<=i;k++)
    {
        (f[k]=f[k-1]*k)%=mod;
    }
    return f[i];
}*/
lli isprime(lli n)
{
    if(n==1)
        return 0;
    for(lli i=2;i<=sqrt(n);i++)
        if(n%i==0)
            return 0;
    return 1;
}
bool cmp(lli i,lli j)
{
    return p[i].size()<p[j].size();
}
 
/*void sieve()
{
    for(lli i=2;i<=5000000;i++)
    {
        if(b[i]==0)
        {
        for(lli j=2;i*j<=5000000;j++)
        {
            b[i*j]=1;
        }
        }
    }
}*/

lli n,k;
bool check(lli x)
{
    lli c=k,j;ld f;
    for(lli i=1;i<=n;i++)
    {
        f=a[i]/x;
        j=ceil(f);
        c-=(j-1);
        //cout<<c<<" "<<j<<endl;
        if(c<0)return false;
    }
    return true;
}
int main ()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cin>>n>>k;
    ld r=0;
    for(lli i=1;i<=n;i++)
    {
        cin>>a[i];
        r=max(r,a[i]);
    }
    ld l=1;lli ans=r;
    while(l<=r)
    {
        ld mid=(l+r)/2;
        lli x=ceil(mid);
        //cout<<x<<endl;
        if(check(x))
        {
            ans=x;
            r=x-1;
        }
        else l=x+1;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 19468
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

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

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

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

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    int N, K;
    cin >> N >> K;
    vi sticks = input<int>(N);

    sort(all(sticks));

    int maxLength = 0;
    for (int i = 0; i < K; ++i) {
        maxLength += sticks[sticks.size() - 1 - i];
    }
    cout << maxLength << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int r;
    cin>>r;
    cout<<fix<<2.0*r*acos(-1);
    return 0;
}


Measured memory_bytes: 3780
s=input()
n=len(s)
f=0
for i in range(1<<n-1):
    a=s[0]
    for j in range(n-1):
 
        if i&(1<<j):
            
            a+='+'+s[j+1]
        else:
            a+=s[j+1]
    f+=eval(a)
print(f)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;  
using namespace std;

typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
//defines
typedef long long ll;
typedef long double ld;

ll a,b,c,n,m,k;

ll t=1;

void solve()
{
   cin>>n>>k>>m;
   c=0;
   map<ll,ll>sum,f;
   for(ll i=0;i<n;i++)
   {
       c+=k;
       sum[i]=c;
       k=(k*k)%m;
       if(k==0)break;
       else if(f.find(k)!=f.end())
       {
           ll rest=(n-i-1);
           ll add=(c-sum[f[k]]);
           ll re=(i-f[k]);
           
           c+=((rest/re)*add)+(sum[f[k]+(rest%re)]-sum[f[k]]);
           break;
       }
       else
       {
           f[k]=i;
       }
   }
   cout<<c;
 if(t>0)cout<<"\n";
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    
   //cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

Measured memory_bytes: 9800
N = input()
empty = ["" for _ in range(2)]

def searchright(knowledge):
    for u in [".", "#"]:
        for l in [".", "#"]:
            hypothesis = [knowledge[0] + u, knowledge[1] + l]
            print("\n".join(hypothesis))
            p = input()
            if p == "T":
                return searchright(hypothesis)
            elif p=="end":
                exit()
    return knowledge

def searchleft(knowledge):
    for u in [".", "#"]:
        for l in [".", "#"]:
            hypothesis = [u + knowledge[0], l + knowledge[1]]
            print("\n".join(hypothesis))
            p = input()
            if p == "T":
                return searchleft(hypothesis)
            elif p=="end":
                exit()
    return knowledge

print(searchleft(searchright(empty)))

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

int main() {
	string s, t;
	cin>>s;
	cin>>t;
	
	int n=s.size();
	int res=0;
	for(int i=0;i<n;i++) {
		if(s[i]!=t[i])
			res++;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 3912
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define INF 200000000

using namespace std;

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

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

	double x1, x2, y1, y2, x3, y3;
	cin >> x1 >> y1 >> x2 >> y2;

	x3 = (x2 - x1) / sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
	y3 = (y2 - y1) / sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));

	int q;
	cin >> q;

	for (int i = 0; i < q; i++)
	{
		double px, py, px2, py2;
		cin >> px >> py;

		px2 = (px - x1);
		py2 = (py - y1);

		printf("%.10lf %.10lf\n", x1 + x3*(px2*x3 + py2*y3), y1 + y3*(px2*x3 + py2*y3));
	}

	return 0;
}


Measured memory_bytes: 3300
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(b/a >= c) {
			System.out.println(c);
		}else {
			System.out.println((int)Math.floor(b/a));
		}
	}
}

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

int main(){
    int w,h,n;
    cin>>w>>h>>n;
    int b[4]={0,w,0,h};
    for(int i=0;i<n;i++){
        int x,y,a;
        cin>>x>>y>>a;
        if(a==1)b[0]=max(b[0],x);
        else if(a==2)b[1]=min(b[1],x);
        else if(a==3)b[2]=max(b[2],y);
        else b[3]=min(b[3],y);
    }
    int dx=max(0,b[1]-b[0]);
    int dy=max(0,b[3]-b[2]);
    cout<<dx*dy<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

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

  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  rep(i, n) cin >> c[i];

  sort(a.begin(), a.end());
  sort(c.begin(), c.end());

  ll ans = 0;
  rep(i, n) {
    ll cnt = 1;
    cnt *= lower_bound(a.begin(), a.end(), b[i]) - a.begin();
    cnt *= c.end() - upper_bound(c.begin(), c.end(), b[i]);
    cerr << cnt << endl;
    ans += cnt;
  }
  cout << ans << endl;
}


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

int LinearSearch(int S[],int T[],int N,int M){
  int C=0;
  for(int i=0;i<M;i++){
    for(int j=0;j<N;j++){
       if(S[j]==T[i]){
         C++;
         break;
     }
   }
 }
  return C;
}

int main(){
  int n,m;
  cin>>n;
  int S[n];
  for(int i=0;i<n;i++){
    cin>>S[i];
  }
  cin>>m;
  int T[m];
  for(int i=0;i<m;i++){
    cin>>T[i];
  }
  cout<<LinearSearch(S,T,n,m)<<endl;
}



Measured memory_bytes: 3072
#include<iostream>
using namespace std;
int main()
{
  int n,a,b,t,i,r,res=0;
  cin >> n >> a >> b;
  for(i=1;i<=n;i++){
    t=i;
    r=0;
    while(t>0){
      r+=t%10;
      t/=10;
    }
    if(r>=a && r<=b)
      res+=i;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <cstdio>

int main()
{
    int a, b;

    scanf("%d %d", &a, &b);
    
    if (a == b){
        printf("a == b\n");
    }
    else if (a > b){
        printf("a > b\n");
    }
    else {
        printf("a < b\n");
    }

    return 0;
}

Measured memory_bytes: 1008
#include <stdio.h>
long a,b,k;
int main(){
    scanf("%ld%ld%ld",&a,&b,&k);
    if(a<k)k-=a;
    else {
        a-=k;
        printf("%ld %ld",a,b);
        return 0;
    }
    if(b<k)puts("0 0");
    else printf("0 %ld",b-k);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
#define rep(i,n) for (ll i=0;i<n;i++)
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    ll cnt = 0;
    bool q = false;
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        if(a==b){
            cnt++;
        }else{
            cnt = 0;
        }
        if(cnt>=3) {
            q = true;
        }
        
    }
    if(q) cout << "Yes";
    else{
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e6+10;
int n,flag;
int fac[maxn];
int a[maxn];
void init(int n)
{
	fac[0]=0;
	for (int i=1;i<=n;i++)
	{
		fac[i]=fac[i-1];
		int tmp=i;
		while (!(tmp&1)) tmp/=2,fac[i]++;
	}
}
int C(int n,int m) {return (fac[n]-fac[m]-fac[n-m])==0;}
int main()
{
	cin>>n;getchar();
	for (int i=1;i<=n;i++)
	{
		char c=getchar();
		a[i]=c-48;
		if (a[i]==2) flag=1;
	}
	init(n);
	if (flag)
	{
		int tmp=0;
		for (int i=1;i<=n;i++)
			if (a[i]==2) tmp+=C(n-1,i-1);
		cout<<tmp%2<<endl;
		return 0;
	}
	int tmp=0;
	for (int i=1;i<=n;i++)
		if (a[i]==3) tmp+=C(n-1,i-1);
	cout<<tmp%2*2<<endl;
    return 0;
}


Measured memory_bytes: 8064
import java.util.*

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xArray = readLine()!!.split(" ").map(String::toInt)
  val arrayList = arrayListOf<Int>()
  (1..(xArray.max()?:1)).forEach {
    arrayList.add(cunsumption(it, xArray))
  }
  println(arrayList.min())
}

fun cunsumption(p: Int, xArray: List<Int>): Int {
  var cunsumption = 0
  xArray.forEach { cunsumption += (it - p)*(it - p) }
  return cunsumption
}

Measured memory_bytes: 37992
package main

import "fmt"

func main() {
	var A, B, C, D int
	fmt.Scan(&A, &B, &C, &D)
	for {
		C = C - B
		if C <= 0 {
			fmt.Println("Yes")
			return
		}
		A = A - D
		if A <= 0 {
			fmt.Println("No")
			return
		}
	}
}


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

int main() {
    int N, M;
    cin >> N >> M;
    
    vector<int> city(N,0);
    for (int i = 0; i < 2*M; i++) {
        int a;
        cin >> a;
        city.at(a - 1)++;
    }

    for(int i = 0; i < N; i++) {
        cout << city.at(i) << endl;
    }
}


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

using namespace std;

#define INF INT_MAX
#define F first
#define S second

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

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

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

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



Measured memory_bytes: 384
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

n, k = map(int, readline().split())
r, s, p = map(int, readline().split())
t = read().rstrip().decode("utf-8")


points = {}
player = {}

player['r'] = 'p'
player['s'] = 'r'
player['p'] = 's'
points['p'] = p
points['r'] = r
points['s'] = s

ans = 0

for i in range(k):
    t_ = t[i::k] + '.'
    hands = ['.'] * len(t_)
    for i in range(len(t_) - 1):
        c = t_[i]
        if i < 1:
            ans += points[player[c]]
            hands[i] = player[c]
        elif player[c] != hands[i-1]:
            ans += points[player[c]]
            hands[i] = player[c]
        else:
            hands[i] = set(player.values()) and not player[c] and player[t_[i+1]]

print(ans)

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int cnt = 0;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        if (i * 500 + j * 100 + k * 50 == X) cnt++;
      }
    }
  }
  cout << cnt << "\n";
}

Measured memory_bytes: 3636