akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define pb(n) push_back(n);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
vector<int> vi;
vector<lln> vl;
vector<pii> vii;
vector<pll> vll;


char arr[105][105];
int arr2[maxii];
bool check[maxii];
bool check2[1000][1000];
int n,m;
int x[]={1,-1,0,0};
int y[]={0,0,-1,1};
int x2[]={1,-1,0,0,1,-1,1,-1};
int y2[]={0,0,-1,1,1,-1,-1,1};
int bx[]={0,0,1,-1,-1,1,1,-1};
int by[]={1,-1,0,0,-1,-1,1,1};
int kx[] = {1,1,2,2,-1,-1,-2,-2};
int ky[] = {2,-2,1,-1,2,-2,1,-1};

bool isvisited(int x,int y)
{
    if(x<1 || y<1 || x>n ||y>m)
    {
        return false;
    }
    else if(check2[x][y]==true)
    {
        return false;
    }
    else true;
}
int gcd(int a,int b)
{
    if(b==0){
      return a;
     }
    return gcd(b,a%b);
}
int lcm(int a,int b)
{
    int res=(a*b)/gcd(a,b);
    return res;
}
int po(int a,int b)
{
    int res=1;
    while(b)
    {
        if(b%2!=0)
        {
            res*=a;
            b--;
        }
        else
        {
            a*=a;
            b/=2;
        }
    }
    return res;
}

lln modMul(lln  a, lln b,lln mod){
    lln ans = 0;
    a = a % mod;
    while (b > 0){
        if ( b % 2 )ans = (ans%mod+ a%mod) % mod;
        a = (a%mod * 2%mod) % mod;
        b /= 2;
    }
    return ans % mod;
}
lln powerMod(lln a,lln b,lln mod){
	if(b==0)return 1LL%mod;
	lln x=powerMod( a,b/2,mod );
	x = ( x%mod * x%mod ) % mod;
	if( b%2==1 )x = ( x%mod * a%mod ) % mod;
	return x%mod;
}

int main()
{
    int n,m;
    sc(n)
    sc(m)
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>arr[i][j];
        }
    }
    for(int i=0;i<=n+1;i++)
    {
        for(int j=0;j<=m+1;j++)
        {
            if(arr[i][j]>='a' && arr[i][j]<='z'){}
            else {
                arr[i][j]='#';
            }
        }
    }
    for(int i=0;i<=n+1;i++)
    {
        for(int j=0;j<=m+1;j++)
        {
            cout<<arr[i][j];
        }
        cout<<endl;
    }

}





Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  int m;
  cin>>m;
  vector<int> b(m);
  for(int i=0;i<m;i++) cin>>b[i];

  vector<int> c;
  set_intersection(a.begin(),a.end(),b.begin(),b.end(),back_inserter(c));
  for(int x:c) cout<<x<<endl;
  return 0;
}



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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

int a,b,h,w,f[100][100];
bool flg=false;

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

	cin>>a>>b;
	a--,b--;
	REP(i,100) FOR(j,50,100) f[i][j]=1;
	for(int i=0;i<100;i+=2) {
		for(int j=0;j<50;j+=2) {
			if(b) f[i][j]=1,b--;
		}
	}
	for(int i=0;i<100;i+=2) {
		for(int j=51;j<100;j+=2) {
			if(a) f[i][j]=0,a--;
		}
	}
	cout<<100<<' '<<100<<endl;
	REP(i,100) {
		REP(j,100) {
			cout<<(f[i][j]?'#':'.');
		}
		cout<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
while True:
    n, x = list(map(int, input().split()))
    if n == x == 0:
        break
    res = 0
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    res += 1
    print(res)



Measured memory_bytes: 5596
a, b = map(int, input().split())

def f(a, b):
    if a <= 0 <= b:
        return 0
    if a > 0:
        return 1
    b = min(b, -1)
    n = b - a + 1
    return (-1) ** n

words = ['Zero', 'Positive', 'Negative']
print(words[f(a, b)])


Measured memory_bytes: 9044
h,w = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
b = [list(map(int, input().split())) for i in range(h)]
# zeroは真ん中にする
ma = 80*2*80
DP = [[0]*w for i in range(h)]

for i in range(h):
    for j in range(w):
        k = abs(a[i][j]-b[i][j])
        if i|j:
            m = DP[i-1][j]|DP[i][j-1]
        else:
            m = 1<<ma
        DP[i][j] = (m<<k)|(m>>k)

k = 1<<ma
for i in range(ma):
    if DP[-1][-1]&(k>>i) or DP[-1][-1]&(k<<i):
        print(i)
        exit()

Measured memory_bytes: 55900
//Author : Vivek Dubey
#include <bits/stdc++.h>
using namespace std;

// debug start
	template <typename A, typename B>
	string to_string(pair<A, B> p);
	 
	template <typename A, typename B, typename C>
	string to_string(tuple<A, B, C> p);
	 
	template <typename A, typename B, typename C, typename D>
	string to_string(tuple<A, B, C, D> p);
	 
	string to_string(const string& s) {
	  return '"' + s + '"';
	}
	 
	string to_string(const char* s) {
	  return to_string((string) s);
	}
	 
	string to_string(bool b) {
	  return (b ? "true" : "false");
	}
	 
	string to_string(vector<bool> v) {
	  bool first = true;
	  string res = "{";
	  for (int i = 0; i < static_cast<int>(v.size()); i++) {
	    if (!first) {
	      res += ", ";
	    }
	    first = false;
	    res += to_string(v[i]);
	  }
	  res += "}";
	  return res;
	}
	 
	template <size_t N>
	string to_string(bitset<N> v) {
	  string res = "";
	  for (size_t i = 0; i < N; i++) {
	    res += static_cast<char>('0' + v[i]);
	  }
	  return res;
	}
	 
	template <typename A>
	string to_string(A v) {
	  bool first = true;
	  string res = "{";
	  for (const auto &x : v) {
	    if (!first) {
	      res += ", ";
	    }
	    first = false;
	    res += to_string(x);
	  }
	  res += "}";
	  return res;
	}
	 
	template <typename A, typename B>
	string to_string(pair<A, B> p) {
	  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
	}
	 
	template <typename A, typename B, typename C>
	string to_string(tuple<A, B, C> p) {
	  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
	}
	 
	template <typename A, typename B, typename C, typename D>
	string to_string(tuple<A, B, C, D> p) {
	  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
	}
	 
	void debug_out() { cerr << endl; }
	 
	template <typename Head, typename... Tail>
	void debug_out(Head H, Tail... T) {
	  cerr << " " << to_string(H);
	  debug_out(T...);
	}
	 
	#ifndef ONLINE_JUDGE
	#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
	#else
	#define debug(...) 42
	#endif
// end debug

	#define int long long

	const int mod = 1e9 + 7;
	
const int mxN = 3e5 + 1;

int S, k;
int a[mxN];

void solve() {
	cin >> S;
	int dp[S + 1]  = {};
	dp[0] = 1;
	for(int i = 1; i <= S; i++) {
		for(int j = 3; j <= i; j++) {
			dp[i] += dp[i - j];
			dp[i] %= mod;
		}
	}
	cout << dp[S];
}

int32_t main() {
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
		freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    //this can be opted out if you want to print the output to the sublime console
		freopen("output.txt", "w", stdout);
	#endif

	// for fast i/o
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL); 
	cout.tie(NULL);

	// test cases
	int t = 1;
	// cin >> t;
	while(t--) {
		solve();
	}

	return 0;
}

Measured memory_bytes: 3640
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(ALL(a));

    bool plus = true;
    bool minus = true;
    rep(i, n){
        if(a[i] >= 0){
            minus = false;
        }
        if(a[i] <= 0){
            plus = false;
        }
    }

    int ans = a.back() - a[0];
    vector<int> p, m;
    m.push_back(a[0]);
    for(int i = 1; i < n - 1; i++){
        ans += abs(a[i]);
        if(a[i] >= 0){
            p.push_back(a[i]);
        }else{
            m.push_back(a[i]);
        }
    }

    cout << ans << endl;
    for(int x : p){
        cout << m.back() << " " << x << endl;
        m.back() -= x;
    }
    for(int x : m){
        cout << a.back() << " " << x << endl;
        a.back() -= x;
    }

    return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    long long h[100001];
    int flag=0;
    for(int i=0;i<n;i++){
        cin>>h[i];
        if(i>0&&h[i-1]>h[i]+1)
            flag=1;
        if(i>0&&h[i]+1==h[i-1])
            h[i]+=1;
    }
    if(flag) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll h,w;
  cin>>h>>w;
  vvll a(h,vll(w)),b(h,vll(w));
  rep(i,h)rep(j,w) {
    cin>>a[i][j];
    b[i][j]=a[i][j];
  }
  ll i=0;
  ll j=0;
  ll ans=0;
  ll kh,kw;
  if(h%2==0){
    kh=h;kw==1;
  }
  else{
    kh=h;
    kw=w;
  }
  while(1){
    if(((i%2==0)&&(j==w-1))||((i%2==1)&&(j==0))){
      
      i++;
      if(i==h) break;
      if(b[i-1][j]%2==1){
        b[i][j]++;
        ans++;
      }
    }
    else if(i%2==0){
      j++;
      if(b[i][j-1]%2==1){
        b[i][j]++;
        ans++;
      }
    }
    else if(i%2==1){
      j--;
      if(b[i][j+1]%2==1){
        b[i][j]++;
        ans++;
      }
    }
  }
  COUT(ans);
  i=0;
  j=0;
  while(1){
    if(((i%2==0)&&(j==w-1))||((i%2==1)&&(j==0))){
     
      i++;
      if(i==h) break;
      if(a[i-1][j]%2==1){
        a[i][j]++;
        cout<<i-1+1<<" "<<j+1<<" "<<i+1<<" "<<j+1<<endl;
      }
    }
    else if(i%2==0){
      j++;
      if(a[i][j-1]%2==1){
        a[i][j]++;
        cout<<i+1<<" "<<j-1+1<<" "<<i+1<<" "<<j+1<<endl;
      }
    }
    else if(i%2==1){
      j--;
      if(a[i][j+1]%2==1){
        a[i][j]++;
        cout<<i+1<<" "<<j+1+1<<" "<<i+1<<" "<<1+j<<endl;
      }
    }
  }
}


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

#define vi vector<int>
#define tests int t; cin>>t; while(t--)
#define ll long long
#define vll vector<long long>
#define srt(v) sort(v.begin(), v.end())
#define srtg(v) sort(v.begin(), v.end(), greater<int> ())
#define FOR(k, n) for(int k=0; k<n; k++)
#define pb push_back
#define int long long 


using namespace std;
using namespace std::chrono;

char nums[10] = { '0','1','2','3','4','5','6','7','8','9' };
char alphsl[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
const ll MOD = 1000000007;
char alphs[26] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };


int ceil(int a, int b){
    int ans=a/b;
    if(a%b) ans++;
    return ans;
}


void solve() {

    int n, k;
    cin>>n>>k;
    vi v(n);
    int maxy=0;
    for(int i=0; i<n; i++){
        cin>>v[i];
        maxy=max(maxy, v[i]);
    }
    
    int start=1, end=maxy;
    
    while(start<end-10){
        int steps=0, mid=(start+end)/2;
        for(auto x : v) steps+=ceil(x, mid)-1;
        
        if(steps>k) start=mid;
        if(steps<=k) end=mid;
        
    }
    int ans=start;
    for(int i=end; i>=start; i--){
        int steps=0;
        for(auto x : v) steps+=ceil(x, i)-1;
        if(steps>k){
            ans=i+1;
            break;
        }
        
    }
    cout<<ans<<endl;
    
}


signed main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

        
        solve();


    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = int.Parse(Console.ReadLine());
        int x = int.Parse(Console.ReadLine());
        int count = 0;
        for (int i = 0; i <= a; i++)
        {
            for (int j = 0; j <= b; j++)
            {
                for (int k = 0; k <= c; k++)
                {
                    if (500 * i + 100 * j + 50 * k == x)
                    {
                        count++;
                    }
                }
            }
        }
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int H = sc.nextInt();
      int W = sc.nextInt();
      int h = sc.nextInt();
      int w = sc.nextInt();
      int sum = H * W;
      int score = sum - h * W - w * H + h * w;
      System.out.println(score);
    }
}

Measured memory_bytes: 24916
#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>;

ll N, M;

int par[100005];  //親の番号
ll combi[100005];
ll res[100005];

void init(int n) {
    for (int i = 0; i < n; ++i) {
        par[i] = i;
        combi[i] = 1;
    }
}

int root(int x) {
    if (par[x] == x) {
        return x;
    } else {
        return par[x] = root(par[x]);
    }
}

bool same(int x, int y) { return root(x) == root(y); }

void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;

    par[x] = y;
}

int main() {
    cin >> N >> M;
    vector<int> A(M), B(M);
    rep(i, M) {
        cin >> A[i] >> B[i];
        --A[i];
        --B[i];
    }

    init(N);

    res[M - 1] = N * (N - 1) / 2;
    for (int i = M - 1; i > 0; --i) {
        if (!same(A[i], B[i])) {
            ll total = combi[root(A[i])] + combi[root(B[i])];
            res[i - 1] = res[i] - combi[root(A[i])] * combi[root(B[i])];
            unite(A[i], B[i]);
            combi[root(A[i])] = total;
        } else {
            res[i - 1] = res[i];
        }
    }
    rep(i, M) cout << res[i] << endl;
}

Measured memory_bytes: 5932
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i
ans = 0

for l in 0..a
    for m in 0..b
        for n in 0..c
            sum = 500*l + 100*m + 50*n
            if x == sum then
                ans += 1
            end
        end
    end
end
p ans

Measured memory_bytes: 1788
def main():
    N,M,K = map(int,input().split())
    MOD = 998244353
    ans = 0

    # Σ(0<=x<=K){M*pow((M-1),(N-x-1))*Combination(N-1,x)}を求めたい

    fact = [1] * (N+1) # 階乗を格納するリスト
    factinv = [1] * (N+1) # 階乗を格納するリスト
    for i in range(N):
        fact[i+1] = fact[i] * (i+1) % MOD # 階乗を計算
        factinv[i+1] = pow(fact[i+1], MOD-2, MOD)# MODを法とした逆元（フェルマーの小定理）

    def comb(n,k): # 組み合わせ(MOD)を返却する
        return fact[n] * factinv[n-k] * factinv[k] % MOD

    def solve(k):
        r = M * pow(M-1,N-1-k,MOD) * comb(N-1,k)
        return r

    for k in range(K+1):
        ans += solve(k)
        ans %= MOD
    print (ans)

main()


Measured memory_bytes: 24584
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}
ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}
 
 int main()
 {
        ll n,m;
        cin>>n>>m;
        ll a[n+1];
        priority_queue<ll> pq;
        for(int i=1;i<=n;i++)
        {
        	 cin>>a[i];
        	 pq.push(a[i]);
        }  
         
        while(m--)
        {
        	ll k = pq.top();
        	pq.pop();
        	if(k==0) break;
        	k = k>>1;
        	pq.push(k);  
        }  
        
        ll res=0;
        while(!pq.empty())
        {
            res+=pq.top();
            pq.pop();
        }

        cout<<res<<endl;

        
 }

Measured memory_bytes: 1912
package main

import (
	"fmt"
)

func main() {
	var S string
	fmt.Scan(&S)

	ans := "Yes"
	if S[0] == S[1] && S[1] == S[2] && S[0] == S[2] {
		ans = "No"
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
X = int(input())
if X < 600:
    print(8)
elif X<800:
    print(7)
elif X<1000:
    print(6)
elif X<1200:
    print(5)
elif X<1400:
    print(4)
elif X<1600:
    print(3)
elif X<1800:
    print(2)
else:
    print(1)

Measured memory_bytes: 61616
#include<bits/stdc++.h>
#define ll long long
#define MAXN 100005
#define mod 998244353
#define INF 0x3f3f3f3f
#define ld long double
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    #define int ll
    int a,b;
    int n,k;
    cin>>n>>k;
    a=n%k;
    b=k-a;
    cout<<min(a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    double l;
    cin >> l;

    cout << fixed << setprecision(10) << pow(l / 3, 3) << endl;

    // int res = 0.0;
    // REP(i, 1, l+1) {
    //     REP(j, i, l+1) {
    //         if (j + i >= l) continue;
    //         int k = l - i - j;
    //         chmax(res, i * j * k);
    //     }
    // }

    // cout << fixed << setprecision(10) << double(res) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x) // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    string s, t;
    cin >> n >> s >> t;
    for (ll i = 0; i < n; i++)
    {
        cout << s[i] << t[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int base = 7;
		int idx = 1;
		HashSet<Integer> set = new HashSet<>();
		while (true) {
		    if (base % k == 0) {
		        System.out.println(idx);
		        return;
		    }
		    if (set.contains(base % k)) {
		        break;
		    }
		    set.add(base % k);
		    idx++;
		    base = (base * 10 + 7) % k;
		}
		System.out.println(-1);
	}
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if ((A + B) > (C + D)) {
    cout << "Left" <<endl;
  }
  else if ((A + B) < (C + D)) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int n,m; cin >>n>>m;
    vector<vector<int> > s(m, vector<int>(n , 0));
    for (int i = 0; i < m; i++) {
        int k; cin >>k;
        for (int j = 0; j < k; j++) {
            int ss; cin >> ss;
            s[i][ss-1] = 1;
        }
    }
    vector<int> p(m);
    for (int i = 0; i < m; i++) {
        cin >> p[i];
    }

    int res = 0;
    for (int bit = 0; bit < (1<<n); bit++) {
        bool flag = true;
        for (int i = 0; i < m; i++) {
            int sum = 0;
            for (int j = 0; j < n; j++) {
                if ((bit & (1<<j)) && s[i][j] == 1) {
                    sum++;
                }
            }
            if (sum % 2 != p[i]) {
                flag = false;
            } 
        }
        if (flag) {
            res++;
        } 
    }
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cassert>
#include<stdexcept>
#include<utility>
#include<functional>
#include<numeric>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<array>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<string>
#include<bitset>
using namespace std;
using ll=long long;

const ll MOD=1e9+7;
int main(){
    int n;
    int h,d;
    cin>>n>>h>>d;
    vector<ll> fact(n+1);
    fact[0]=1;
    for(int i=1;i<=n;i++) fact[i]=fact[i-1]*i%MOD;
    vector<ll> dp(h+1);
    ll v=(accumulate(fact.begin(),fact.end(),0LL)-1)%MOD;
    dp[0]=fact[n];
    ll sum=dp[0];    
    for(int i=1;i<h;i++){
        if(i-d-1>=0){
            sum-=dp[i-d-1];
            sum%=MOD;
        }
        dp[i]=sum*v%MOD;
        sum+=dp[i];
        sum%=MOD;
    }
    ll res=0;
    for(int i=h-d;i<h;i++){
        res+=dp[i];
        res%=MOD;
    }
    res=(res+MOD)%MOD;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 15872
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}

int main()
{
    ios;
    int a,b;
    cin>>a>>b;
    if(a>=10||b>=10)
        cout<<-1<<endl;
    else
        cout<<a*b<<endl;



}













Measured memory_bytes: 3608
import java.util.Scanner;
//import java.lang.Math;

class Main{
	
	public static void main(String[] arg){
	Scanner sc=new Scanner(System.in);
	//総点数
		
	while(true){
		
		double sum=0.0;
        double go;
		int cnt=sc.nextInt();//件数
		double[] suji=new double[cnt];//点数
		
		if(cnt==0){
			break;
		}
	for(int i=0;i<cnt;i++){
		suji[i]=sc.nextDouble();
		sum+=suji[i];
	}
		double ave= sum/cnt;
		sum=0.0;
	for(int j=0;j<cnt;j++){
			sum+=Math.pow((suji[j]-ave),2);
			
		}
		
		
		 go=Math.sqrt(sum/cnt);
		 System.out.printf("%.8f\n",go);
		}}}


Measured memory_bytes: 39412
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
const long long mod = 1e9 + 7;
typedef long long ll;

int main(){
  int n;
  cin >> n;
  double a[n];
  double bunsi = 1, bunbo = 0;
  rep(i,n){
    cin >> a[i];
    bunsi *= a[i];
  }
  rep(i, n){
    double bun = 1.0;
    rep(j, n){
      if(i != j) bun *= a[j]; 
    }
    bunbo += bun;
  }
  printf("%.10f", bunsi / bunbo);
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> used(n), st;
	for (int i = 0, e; i < m; i++) {
		cin >> e;
		st.push_back(e);
	}
	while (!st.empty()) {
		if (!used[st.back() - 1]) {
			used[st.back() - 1] = 1;
			cout << st.back() << endl;
		}
		st.pop_back();
	}
	for (int i = 0; i < n; i++) {
		if (!used[i]) {
			cout << i + 1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 4332
#include <stdio.h>

int main()
{
  int i,j;
  int M[100][100];
  int n,u,k,v;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v]=1;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(j>0) printf(" ");
      printf("%d",M[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 636
import java.util.*;

public class Main {
  private static List<String> list = new ArrayList<>();
  private static long ans = 0;
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    String[] numbers = sc.next().split("");
    String str = numbers[0];
    recursive(1, numbers, str);
    list.stream().map(e -> e.split("\\+")).forEach(e -> {
      ans += Arrays.stream(e).mapToLong(Long::parseLong).sum();
    });
    System.out.println(ans);
  }
  public static void recursive(int index, String[] arr, String str) {
    if(index >= arr.length) {
      list.add(str);
      return;
    }
    recursive(index + 1, arr, str + "+" + arr[index]);
    recursive(index + 1, arr, str + arr[index]);
  }
}


Measured memory_bytes: 26964
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  string S;
  cin>>S;
  int N=S.size();
  vii dp(N+1,vi(13));
  int ten=10;
  if(S[N-1]=='?'){
    rep(i,0,10)
      dp[1][i]=1;
  }
  else{
    int X=S[N-1]-'0';
    dp[1][X]=1;
  }
  rep(i,1,N){
    if(S[N-1-i]=='?'){
      rep(j,0,10){
        rep(k,0,13){
          dp[i+1][k]+=dp[i][(k+13-ten*j%13)%13];
          dp[i+1][k]%=MOD;
        }
      }
    }
    else{
      int X=(S[N-1-i]-'0')*ten%13;
      rep(j,0,13){
        dp[i+1][j]+=dp[i][(j+13-X)%13];
        dp[i+1][j]%=MOD;
      }
    }
    ten*=10;
    ten%=13;
  }
  cout<<dp[N][5]<<endl;
  }



Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
const int N=300005,P=998244353,iv2=499122177;
#define ll long long
int n,m,s,a[N],b[N],p[N];
inline ll pw(ll a,ll b){ll r=1;for(;b;b>>=1,a=a*a%P)if(b&1)r=r*a%P;return r;}
inline void fwt(int *a){for(int i=1;i<m;i<<=1)for(int j=0;j<m;j++)if(j&i){int u=a[j^i],v=a[j];a[j^i]=(u+v)%P;a[j]=(u-v+P)%P;}}
inline void ifwt(int *a){for(int i=1;i<m;i<<=1)for(int j=0;j<m;j++)if(j&i){int u=a[j^i],v=a[j];a[j^i]=1ll*iv2*(u+v)%P;a[j]=1ll*iv2*(u-v+P)%P;}}
int main()
{
	scanf("%d",&n);m=1<<n;
	for(int i=0;i<m;i++)scanf("%d",&p[i]),s=(s+p[i])%P;
	a[0]=m-1;for(int i=1;i<m;i++)a[i]=P-1;
	s=pw(s,P-2);for(int i=0;i<m;i++)b[i]=1ll*p[i]*s%P;b[0]=(b[0]-1+P)%P;
	fwt(a);fwt(b);a[0]=0;
	for(int i=1;i<m;i++)a[i]=1ll*a[i]*pw(b[i],P-2)%P;
	ifwt(a);int t=1ll*(P-a[0])*m%P;fwt(a);a[0]=t;ifwt(a);
	for(int i=0;i<m;i++)printf("%d\n",a[i]);
	return 0;
}


Measured memory_bytes: 5888
#include "bits/stdc++.h"
using namespace std;
#define maxn 501
#define rep(i,n) for(int i=0; i<int(n); ++i)
#define pb push_back
#define mp make_pair
#define mod 1000000007

int n;
long long a[100];
long long k;

bool is_tail(){
	return 0;
}

void do_one(int j){
	a[j] -= n + 1;
	rep(i, n) a[i] ++;
	k++;
}

void debug(){
	cout << k << endl;
	rep(i, n) cout << a[i] << ' '; cout << endl;
}
void solve(){
	cin >> n;
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	reverse(a, a + n);
	k = 0;
	//if (is_tail()) k += tail();
	//debug();
	//a[n] = n - 1;
	for(int i=1; i<n; ++i){
		long long diff = a[i - 1] - a[i];
		//cout << "d " << diff << endl;
		if (diff < n) continue;
		int delta = n + 1;
		//
		rep(j, i) a[j] -= (n - i + 1) * (diff / delta);
		for (int j = i; j < n; ++j) a[j] += i * (diff / delta);
		k += 1ll * i * (diff / delta);
		//
		while (a[0] - a[i] >= n){
			do_one(0);
			sort(a, a + n);
			reverse(a, a + n);
		}
		//debug();
	}
	if (a[n - 1] > n + n){
		k += 1ll * (a[n - 1] - (n + n)) * n;
		rep(i, n) a[i] -= a[n - 1] - (n + n);
	}
	while (true){
		sort(a, a + n);
		reverse(a, a + n);
		if (a[0] < n){
			cout << k;
			return;
		}
		do_one(0);
	}
}

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0);
    solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n, m;
    cin >> n >> m;
    map <int, int> d;
    for (int i = 0; i < 2 * m; ++i) {
        int x; cin >> x;
        ++d[x];
    }   
    string ans = "YES";
    for (auto e : d) {
        if (e.s % 2)
            ans = "NO";
    }    
    cout << ans << endl;
}   

Measured memory_bytes: 5632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int ft_atoi(char *str, int n)
{
	int i = n;
	int nbr = 0;
	while (i < n + 3 && (str[i] >= '0' && str[i] <= '9'))
	{
		nbr *= 10;
		nbr += (str[i] - 48);
		i++;
	}
	return (nbr);
}

int main()
{
	char str[20];
	scanf("%s", str);
	int x;
	x = abs(ft_atoi(str, 0) - 753);
	int n = 0;
	int len = strlen(str);
	int i;
	i = 0;
	while (i < len)
	{
		if (abs(ft_atoi(str, i)  - 753) < x)
		{
			x = abs(ft_atoi(str, i)  - 753);
			n = i;
		}
		i++;
	}
	int ans = ft_atoi(str, n);
	// printf("%d\n", ans);
	printf("%d\n", x);
	// printf("%d", abs(ans - 753));
	return (0);
}


Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
const ll INF = 1e17;
const int MOD = 1e9 + 7;


ll N[1000],sum;


int main(void) {
	int n = 0; cin >> n;
	FOR(i, 0, n) {
		cin >> N[i];
		sum += N[i];
	}
	sort(N, N + n);
	if (sum - N[n - 1] > N[n - 1])ct("Yes");
	else ct("No");

	return 0;
}


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

int cnt[100001];
vector<pair<int, int>> mod[100001];

bool compare(pair<int, int> x, pair<int, int> y)
{
    if (cnt[x.first] % 2 && cnt[x.first] == x.second)
        return false;
    if (cnt[y.first] % 2 && cnt[y.first] == y.second)
        return true;
    if (cnt[x.first] == cnt[y.first])
        return x.first > y.first;
    return cnt[x.first] > cnt[y.first];
}

int main(void)
{
    int N, M, X;
    cin >> N >> M;

    for (int i = 0; i < N; i++) {
        cin >> X;
        cnt[X]++;
        mod[X % M].push_back(pair<int, int>(X, cnt[X]));
    }

    for (int i = 0; i < M; i++)
        sort(mod[i].begin(), mod[i].end(), compare);

#ifdef DEBUG
    for (int i = 0; i < M; i++) {
        cout << i << ": ";
        for (int j = 0; j < mod[i].size(); j++)
            cout << mod[i][j].first << " ";
        cout << endl;
    }
#endif

    int res = mod[0].size() / 2;
    if (M % 2 == 0) {
        res += mod[M / 2].size() / 2;
        mod[M / 2].clear();
    }

    for (int i = 1; i <= M / 2; i++) {
        while(mod[i].size() && mod[M - i].size()) {
#ifdef DEBUG
            cout << mod[i][mod[i].size() - 1].first << " " << mod[M - i][mod[M - i].size() - 1].first << endl;
#endif
            mod[i].pop_back();
            mod[M - i].pop_back();
            res++;
        }
    }

#ifdef DEBUG
    for (int i = 0; i < M; i++) {
        cout << i << ": ";
        for (int j = 0; j < mod[i].size(); j++)
            cout << mod[i][j].first << " ";
        cout << endl;
    }
#endif

    for (int i = 1; i < M; i++) {
        if (mod[i].size() < 2)
            continue;
        for (int j = 0; j < mod[i].size() - 1; j++) {
            if (mod[i][j].first == mod[i][j + 1].first) {
#ifdef DEBUG
                cout << mod[i][j].first << " " << mod[i][j + 1].first << endl;
#endif
                j++;
                res++;
            }
        }
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 6144
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int n,a[100];
int ans=1;
int q=1;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		ans*=3;
		if (a[i]&1) q*=1;
		else q*=2;
	}
	printf("%d",ans-q);
}

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

using namespace std;

int main(){

	int n,k;
	cin >> n >> k;
	n--;
	for(int i = 0; i < k; i++){
		int x,y;
		cin >> x >> y;

		x--;y--;
		int px = min(x,n-x);
		// xツづ個湘ェツ渉環づ可づヲツづづиツづ個値ツつェツつゥツづュツづゥ
		int py = min(y,n-y);
		if(py < px){
			if(py % 3 == 0){
				cout << 1 << endl;
			}
			else if(py % 3 == 1){
				cout << 2 << endl;
			}
			else
				cout << 3 << endl;
		}
		else{
			if(px % 3 == 0){
				cout << 1 << endl;
			}
			else if(px % 3 == 1){
				cout << 2 << endl;
			}
			else
				cout << 3 << endl;
		}
	}

	int tt;
	cin >> tt;


	return 0;
}

Measured memory_bytes: 0
import itertools
n=int(input())
f=[list(map(int,input().split())) for _ in range(n)]
p=[list(map(int,input().split())) for _ in range(n)]
ans=-(10**12)
for i in range(1,11):
    num=list(itertools.combinations(range(10),i))
    for j in range(len(num)):
        cnt=[0]*n
        cnt2=0
        for k in range(i):
            for l in range(n):
                if f[l][num[j][k]]==1:
                    cnt[l]+=1
        for k in range(n):
            cnt2+=p[k][cnt[k]]
        ans=max(cnt2,ans)
print(ans)


Measured memory_bytes: 68724
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      int[][] array = new int[m][2];
      int[] count = new int[n];
      for(int i = 0;i < m;i++){
      	array[i][0] = sc.nextInt();
        array[i][1] = sc.nextInt();
      }
      for(int i = 0;i < m;i++){
      	for(int j = 1;j <= n;j++){
        	if(array[i][0]==j||array[i][1]==j)count[j-1]++;
        }
      }
      for(int i = 0;i < n;i++){
      System.out.println(count[i]);
      }
    }
}



Measured memory_bytes: 22996
/*
?????????????????¨?????????????????¨????????????
????±???¨?????????????????????????????¨????????????????????¨???????????´??????????????°???????????¶???????????°??¢
*/
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(ll i=0;i<(n);i++)

const double EPS = 1e-14;
int main(void){
	ll n; cin >> n;
	vector<pair<double, double> > point(n);//fi???;x??§?¨???? se ;y??§?¨?
	rep(i, n) scanf("%lf %lf", &point[i].fi, &point[i].se);

	//n????\???°??????????????????
	if(n % 2 == 1){
		printf("NA\n");
		return 0;
	}

	//???????????§??????
	vector<double> len(n);
	rep(i, n - 1){
		double tmp = pow(point[i + 1].fi - point[i].fi, 2) + pow(point[i + 1].se - point[i].se, 2);
		len.push_back(tmp);
	}
	double tmp = pow(point[0].fi - point[n - 1].fi, 2) + pow(point[0].se - point[n - 1].se, 2);
	len.push_back(tmp);
	sort(all(len));
	if(len[n - 1] - len[0] > EPS){
		printf("NA\n");
		return 0;
	}

	//????±???¨????????????????????????????±???????
	vector<double> Px;
	vector<double> Py;
	rep(i, n / 2){
		double x = (point[i].fi + point[i + n / 2].fi) / 2.0;
		Px.push_back(x);
		double y = (point[i].se + point[i + n / 2].se) / 2.0;
		Py.push_back(y);
	}

	//?????§?±???????????±???¨??????????????????????????????????????§??????????????¨?°?????????????????????´??????????????°??????????±???§??????
	sort(all(Px));
	if(Px[n / 2 - 1] - Px[0] > EPS){
		printf("NA\n");
		return 0;
	}
	sort(all(Py));
	if(Py[n / 2 - 1] - Py[0] > EPS){
		printf("NA\n");
		return 0;
	}

	printf("%.9f %.9f\n", Px[0], Py[0]);
	return 0;
}

Measured memory_bytes: 3236
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String inputed;
        int[] alphabets = new int[26];
        char[] Salphabets = new char[26];
        char c = 'a';
        for (int i=0; i<26; i++) {
          Salphabets[i] = c++;
        }
		while(true){

			try {
				inputed = br.readLine();
                if (inputed == null )break;
				for(int i = 0; i < inputed.length(); i++){
                  for(int j = 0; j < 26; j++){  
                    if (inputed.charAt(i)==65+j || inputed.charAt(i)==97+j) {
					alphabets[j] += 1;
				}}}
			} catch (IOException e) {
				e.printStackTrace();
            }
        }
          for(int i =0; i< 26; i++) {
		    System.out.println(Salphabets[i] + " : " + alphabets[i]);
		}
	}
}


Measured memory_bytes: 24496
a, b, c, d = map(int, input().split())

t = 0

while a > 0 and c > 0:
    if t % 2 == 0:
        c = c - b
    else:
        a = a - d
    t += 1
if a > 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9176
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
 
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef complex<double> P;
typedef complex<double> Vec;
typedef pair<int, int> pii;
typedef pair<int, pii> p;
 
#define INF (1<<29)
#define INFL (1ll<<60)
#define EPS (1e-10)
#define PI (acos(-1))
const ll MOD = 1000000007ll;

int main() {
	int n;
	cin >> n;
	cout << n * 800 - 200 * (n / 15) << endl;
	return 0;
}


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

int N;
int M;
map<string, int> str_count;
int ans;

void solve() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    string s;
    cin >> s;
    ++str_count[s];
  }
  cin >> M;
  for (int i = 0; i < M; ++i) {
    string s;
    cin >> s;
    --str_count[s];
  }
  for (auto itr = str_count.begin(); itr != str_count.end(); ++itr) {
    ans = max(ans, itr->second);
  }
  cout << ans << "\n";
}

int main() {
  solve();
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=1005;
const char mt4[5][5]={"aabd","ccbd","efgg","efhh"},mt5[6][6]={"aabbc","dee.c","d..fg","h..fg","hiijj"},mt6[7][7]={"aabc..","ddbc..","..ggef","..hhef","ij..kk","ij..ll"};
const char mt7[8][8]={".aabbcc","d.ee.ff","dg..h..","ig..h..","i.jj.kk","lm..n..","lm..n.."};
int n;
char s[N][N];

signed main(){
	read(n);
	if(n==2) return write(-1),0;
	if(n==3) return puts("aab\nb.b\nbaa"),0;
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) s[i][j]='.';
	for(int i=1;i<=n-4;i+=4){
		for(int x=0;x<4;x++) for(int y=0;y<4;y++) s[i+x][i+y]=mt4[x][y];
	}
	int r=n%4,b=n-3-r;
	if(r==0) for(int x=0;x<4;x++) for(int y=0;y<4;y++) s[b+x][b+y]=mt4[x][y];
	if(r==1) for(int x=0;x<5;x++) for(int y=0;y<5;y++) s[b+x][b+y]=mt5[x][y];
	if(r==2) for(int x=0;x<6;x++) for(int y=0;y<6;y++) s[b+x][b+y]=mt6[x][y];
	if(r==3) for(int x=0;x<7;x++) for(int y=0;y<7;y++) s[b+x][b+y]=mt7[x][y];
	for(int i=1;i<=n;i++,puts("")) for(int j=1;j<=n;j++) putchar(s[i][j]);
}

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

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1'000'000'007;
constexpr ll MOD2   = 998'244'353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#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 CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

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

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

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n; cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int dp[1000000-1];

    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < n; ++i){
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[n - 1] << endl;

return 0;
}


Measured memory_bytes: 4056
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from math import gcd

    A, B = map(int, readline().split())

    print(A * B // gcd(A, B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61596
#include<iostream>
using namespace std;
int main(){
    int n,a=0;
    int aa=0;
    bool ans[100001]={0};
    int l,r;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>l>>r;
        aa+=r-l+1;
    }
    cout<<aa<<endl;
    return 0;
}


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

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

    string ans = "Yes";
    int i = 0;
    while (true) {
        if (i % 2 == 0) c -= b;
        else a -= d;

        if (a <= 0) {
            ans = "No";
            break;
        }
        else if (c <= 0) {
            break;
        }       
        i++;
    }

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

Measured memory_bytes: 3524
N = int(input())
ans = 0
A = 0; B = 0; AB = 0
for i in range(N):
  s = str(input()); n =len(s)
  for i in range(n-1):
    if s[i:i+2] == "AB":
      ans += 1  
  if s[0] == "B" and s[-1] == "A":
    AB += 1
  elif s[0] == "B":
    B += 1
  elif s[-1] == "A":
    A += 1

#print(ans,A,B,AB)
if AB > 0:
  ans += AB-1
  if A == 0 and B == 0:
    temp = 0
  elif A == 0 or B ==0:
    temp = 1
  else: #AかBどちらかもある。
    temp = min(A,B)+1
  #print(temp)
  ans += temp

else:
  ans += min(A,B)

print(ans)
  

Measured memory_bytes: 9184
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <queue>
#include <deque>

using namespace std;

int main(){
    long long n; cin >> n;
    long long ans=1000l*1000*1000*1000+1;
    for(long long i=1; i*i<=n; ++i){
        if(n%i) continue;
        long long a=i, b=n/i;
        ans=min(ans, a+b-2);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256