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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

template <class T1, class T2>
inline void chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
}
template <class T1, class T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return true;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    ll X, N;
    cin >> X >> N;
    vector<bool> p(1000, false);
    rep(i, N) {
        ll num;
        cin >> num;
        p[num] = true;
    }

    ll ans;
    ll upper;
    ll lower;
    for (int i = X + 1;; ++i) {
        if (p[i] == false) {
            upper = i;
            break;
        }
    }
    for (int i = X;; --i) {
        if (p[i] == false) {
            lower = i;
            break;
        }
    }

    if (X - lower <= upper - X) {
        ans = lower;
    } else {
        ans = upper;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3580
#include<stdio.h>
int main(void){
  int N,i,j;
  scanf("%d",&N);
  int cmax=N/4;
  int dmax=N/7;
  for(i=0;i<=cmax;i++){
    for(j=0;j<=dmax;j++){
      if(N==(i*4+j*7)){
        printf("Yes");
        return 0;
      }
    }
  }
  printf("No");
  return 0;
}


Measured memory_bytes: 128
N, K = map(int, input().split())
A = sorted(map(int, input().split()))
F = sorted(map(int, input().split()), reverse=True)


def ok(x):
    need = 0
    for i in range(N):
        need += max(0, A[i] - x // F[i])
    if need <= K:
        return True
    return False


left = -1
right = 10 ** 12 + 1

while right - left > 1:
    mid = (right + left) // 2
    if ok(mid):
        right = mid
    else:
        left = mid

print(right)

Measured memory_bytes: 119500
#include <bits/stdc++.h>
using namespace std;
int a,b,c,k,ans;
int main(){
	scanf("%d%d%d%d",&a,&b,&c,&k);
	if (k<=a+b) ans=min(k,a);
	else ans=a-(k-(a+b));
	printf("%d\n",ans);
return 0;
}

Measured memory_bytes: 3816
#include<iostream>

using namespace std;

int main(){
  int n,k,q;
  cin>>n>>k>>q;
  int a[n],l;
  //初期化
  for(int i=0;i<n;i++){a[i]=0;}
  //代入
  for(int i=0;i<q;i++){
    cin>>l;
    a[l-1]++;
  }
  //結果
  for(int i=0;i<n;i++){k+a[i]-q>0? cout<<"Yes"<<endl : cout<<"No"<<endl;}
}


Measured memory_bytes: 1024
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, mut $var:ident $($r:tt)*) => {
        let mut $var = $iter.next().unwrap().parse::<usize>().unwrap();
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
    ($iter:expr, $var:ident $($r:tt)*) => {
        let $var = $iter.next().unwrap().parse::<usize>().unwrap();
        input_inner!{$iter $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().unwrap()
    };
}
#[allow(unused_macros)]
macro_rules! outbuf {
    ($var:ident) => {
        use std::io::{stdout, BufWriter, Write};
        let stdout = stdout();
        let mut $var = BufWriter::new(stdout.lock());
    };
}

use std::cmp::max;
fn main() {
    input! {n, k, xyc: [(usize, usize, String); n]};
    // outbuf! {out};
    let mut ans = 0;
    let k2 = k * 2;
    let mut b = vec![vec![0; k2 + 1]; k2 + 1];
    let mut ba = vec![vec![0; k2 + 1]; k2 + 1];
    let mut bs = 0;
    for (mut x, y, c) in xyc {
        if c == "W" {
            x += k;
        }
        b[x % k2][y % k2] += 1;
        bs += 1;
    }
    for i in 0..k2 {
        for j in 0..k2 {
            ba[i + 1][j + 1] = ba[i + 1][j] + ba[i][j + 1] - ba[i][j] + b[i][j]
        }
    }
    let get2a = |x1: usize, x2: usize, y1: usize, y2: usize| {
        ba[x2][y2] - ba[x1][y2] - ba[x2][y1] + ba[x1][y1]
    };
    for i in 0..k {
        for j in 0..k {
            let x = get2a(i, i + k, 0, k2) + get2a(0, k2, j, j + k) - 2 * get2a(i, i + k, j, j + k);
            ans = max(ans, x);
            ans = max(ans, bs - x);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 45300
#include<stdio.h>
#define MIN(A,B) ((A) < (B) ? (A) : (B))

int main(void){
     int i,j;
    long long n,k,x,y,ans;
  scanf("%lld %lld %lld %lld",&n,&k,&x,&y);
 ans = x * MIN(n,k);
 if(n > k)
     ans += y * (n - k);
 printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 128
/** Author : Izanagi **/

#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include <bits/stdc++.h>

using namespace std;

const long long Mod = 1e9 + 7;
const long long inf = 1e18;
const long long INF = 1e9 + 7;
const long long Lim = 1e5 + 1e3;
const double eps = 1e-10;

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

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define mem(a,val) memset(a,val,sizeof(a))
#define all(v) v.begin(), v.end()
#define faster ios_base:: sync_with_stdio(false),cin.tie(0),cout.tie(0)

// Debugging Function

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

//------------------------X-----------------------------------//

int main()
{
    int n;

    cin >> n;

    vector <int> dp(3);

   // dp[i] - the total cost such that we did activity i on the last considered day

   for(int day=0; day < n; day++)
   {
       vector<int> new_dp(3,0);
       vector<int> c(3);

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

       // int a, b, c - a lot of implementation

       for(int i=0; i<3; i++)
       {
           for(int j=0; j<3; j++)
           {
               if(i!=j)
               {
                   new_dp[j] = max(new_dp[j],dp[i] + c[j]);
               }
           }
       }
       dp = new_dp;
   }

   cout << max({dp[0],dp[1],dp[2]}) << endl;

   return 0;
}



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

bool compare(pair<string, pair<int,int>> a, pair<string, pair<int,int>> b)
{
    if(a.first != b.first)
        return a.first<b.first;
    else
        return a.second.first>b.second.first;
}

int main()
{
    int N;cin>>N;
    string s;
    int a;
    vector<pair<string,pair<int,int>>> p(N);
    for(int i=0;i<N;i++)
    {
        cin>>s>>a;
        p[i]=make_pair(s,make_pair(a,i+1));
    }
    sort(p.begin(),p.end(),compare);
    for(int i=0;i<N;i++)
        cout<<p[i].second.second<<endl;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
typedef long long int ll;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define MOD 1000000007
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);  
//*s.find_by_order(p)   returns the value of pth largest starting from 0 
//s.order_of_key(p)   returns no. of items that are strictly < p 
//string bin = bitset<64>(m).to_string();     convert decimal m to binary
int main()
{
	fast;ll t1;t1=1;
	while(t1--)
	{
		string s;
		cin>>s;
		if(s[s.length()-1]=='s'){cout<<s<<"es\n";}
		else{cout<<s<<"s\n";}
	}
}


Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    int n;
    while(cin>>n,n){
    vvi v(n+1,vi(n+1,INF));
    rep(i,n+1)v[i][i]=0;
    int hoge = 0;
    rep(i,n){
        int c;
        pii temp; cin>>temp.first>>temp.second>>c;
        v[temp.first][temp.second]=c;
        v[temp.second][temp.first]=c;
        hoge=max(hoge,max(temp.first, temp.second));
    }
    n=hoge+1;
    loop(k,0,n)
    loop(i,0,n)
    loop(j,0,n){
        v[i][j]=min(v[i][j],v[i][k]+v[k][j]);
    }
    //loop(i, 0, n){loop(j, 0, n)cout<<v[i][j]<<" "; puts("");}
    ll ans=INF,temp=0; int num=12;
    loop(i,0,n){
        loop(j,0,n)temp+=v[i][j];
        if(ans>temp){num=i; ans=temp;}
        temp=0;
    }
    cout<<num<<" "<<ans<<endl;
    }
}

Measured memory_bytes: 3068
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] ST = sc.nextLine().split(" ");
        String[] AB = sc.nextLine().split(" ");
        String U = sc.nextLine();
        sc.close();
        String S = ST[0];
        String T = ST[1];
        int A = Integer.parseInt(AB[0]);
        int B = Integer.parseInt(AB[1]);

        if (U.equals(S)) {
            A--;
        } else if (U.equals(T)) {
            B--;
        }

        System.out.println(A + " " + B);

    }
}

Measured memory_bytes: 25556
// AtCoder ABC064 A - RGB Cards
// 2020.1.22 bal4u

#include <stdio.h>

int main()
{
	int r, g, b, x;
	scanf("%d%d%d", &r, &g, &b);
	x = (r*10+g)*10+b;
	puts((x & 3)? "NO": "YES");
	return 0;
}


Measured memory_bytes: 128
n = int(input())
if len(str(n)) == 1:
  print(n)
elif len(str(n)) == 2:
  print(9)
elif len(str(n)) == 3:
  print(9+(n-100+1))
elif len(str(n)) == 4:
  print(9+900)
elif len(str(n)) == 5:
  print(909+(n-10000+1))
elif len(str(n)) == 6:
  print(90909)

Measured memory_bytes: 38256
#include <stdio.h>
int main(void){
    int N;
    scanf("%d",&N);
    long long int a[N+1];
    a[0]=2;
    a[1]=1;
    for(int i=2;i<=N;i++)a[i]=a[i-1]+a[i-2];
    printf("%lld",a[N]);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 1e6 + 50;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int LN = 22;
const int SN = 320;

long long n, m, u, v, k, t, q, x, d, p, a, b, c, s;


int arr[N];
int exists[N];

int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n >> k;
   long long sol = 0;
   for (int i = 1; i <= n; ++i) {
      cin >> arr[i];
      exists[arr[i]]++;
      for (int j = 2000; j > arr[i]; --j) sol += exists[j];
   }
   
   sol *= k;
   sol %= mod;
   
   int prev = 0;
   
   long long mult = (k * (k - 1)) / 2LL;
   mult %= mod;
   
   for (int i = 1; i <= 2000; ++i) {
      sol += ((1LL * prev * mult) % mod) * exists[i];
      sol %= mod;
      prev += exists[i];
   }
   
   cout << sol << endl;
}


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

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    char[] S = scanner.next().toCharArray();
    Arrays.sort(S);
    char ch = 'a';
    for (char s : S) if (ch == s) ch++;
    if (ch > 'z') System.out.println("None");
    else System.out.println(ch);
  }
}


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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    int N;
    cin >> N;
    vector<ll> a(N*3);
    rep(i,N*3) cin >> a[i];

    sort(all(a), greater<ll>());

    ll ans = 0;
    rep(i,N)
    {
        ans += a[i*2+1];
        //cout << ans << endl;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 2560
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

MOD = 10**9 + 7

N,K = map(int,input().split())
A = np.array(input().split(), dtype=np.int64)

# 同じグループ内
def type_1():
    bl1 = A[:,None] > A[None,:]
    bl2 = np.arange(N,dtype=np.int64)[:,None] < np.arange(N,dtype=np.int64)[None,:]
    x = ((bl1 & bl2)*1).astype(np.int64).sum() % MOD
    return x*K%MOD

def type_2():
    # グループ間
    counter = np.bincount(A)
    cum = counter.cumsum()
    larger = N-cum
    x = (larger * counter % MOD).sum() % MOD
    y = K*(K-1)//2 % MOD
    return x*y%MOD

answer = (type_1() + type_2()) % MOD
print(answer)


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

#define pb push_back
#define ll long long
#define fi first
#define se second
const int N = 1e9+7;
#define MOD 1000000007
ll power(ll a, ll b) {ll ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=MOD) ret%=MOD;if(a>=MOD) a%=MOD;b>>=1;}return ret;}
int ncr(int n,int r){if(n<r)return 0;int p=1,k=1;if(n-r<r)r=n-r;if(r!=0){while(r){p*=n;k*=r;int g=__gcd(p, k);p/=g;k/=g;n--;r--;}}else p=1;return p;}
void solve()
{
    int n;
    cin>>n;
    int a[n+1][4];
    for(int i=1;i<=n;i++)
        for(int j=1;j<=3;j++)
            cin>>a[i][j];

    int dp[n+1][4];
    dp[1][1]=a[1][1];
    dp[1][2]=a[1][2];
    dp[1][3]=a[1][3];

    for(int i=2;i<=n;i++)
    {
        dp[i][1]=max(dp[i-1][2],dp[i-1][3])+a[i][1];
        dp[i][2]=max(dp[i-1][1],dp[i-1][3])+a[i][2];
        dp[i][3]=max(dp[i-1][2],dp[i-1][1])+a[i][3];
    }

    int ans=0;

    ans=max(ans,max(dp[n][1],max(dp[n][2],dp[n][3])));
    cout<<ans;
}

int main()
{
    int t=1;
    //t=1;
    // cin>>t;
    // fibonacci();
    while(t--)
    {
        solve();
    }
}

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

int main()
{
    long long a, b, c, d, e, f, g, ans = 0;
    cin >> a >> b >> c >> d >> e >> f >> g;
    /// 1 -> iau nr par de dae
    ans = d - (d & 1) + e - (e & 1) + a - (a & 1) + b;

    if (a != 0 && d != 0 && e != 0)
        ans = max(ans,
                  d - ((d ^ 1) & 1) + e - ((e ^ 1) & 1) + a - ((a ^ 1) & 1) + b);

    //ans *= 2;

    cout << ans;
    return 0;
}


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

int main() {
 
  int a, b, c;
  cin >> a >> b >> c;
  
  vector<int> L(3);
  L = {a, b, c};
  
  sort(L.begin(), L.end());
  
  if(L.at(0) + L.at(1) == L.at(2)){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;  
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)  
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;  
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int dp[N];
// MO's algo 

int ar[N];
int freq[N];
int BLOCK;
int cnt[N];
int ans[N];
struct Mo{
  int l,r,idx;
}Q[N];
int dis = 0;
inline void Add(int pos){
  cnt[ar[pos]]++;
  if(cnt[ar[pos]]==1)dis++;
  
}
inline void Remove(int pos){
  cnt[ar[pos]]--;
  if(cnt[ar[pos]]==0)dis--;
}
bool comp(Mo a, Mo b){
    if(a.l / BLOCK != b.l / BLOCK)
        return a.l < b.l;
    return a.l / BLOCK % 2 ? a.r < b.r : a.r> b.r;
}
signed main(){
  IOS;
  int T=1;
    int n,q;
    cin >> n >> q ;
    for(int i =1;i<=n;i++){
      cin >> ar[i];
    }
    BLOCK =1201;
    int l1,r1;
    for(int i =0 ;i < q;i++){
      cin >> l1>> r1;
      Q[i].l= l1;
      Q[i].r= r1;
      Q[i].idx= i;
    }
    sort(Q,Q+q,comp);
    int lft,rgt,cl = 0 ,cr = 0;
    for(int i =0 ;i <q;i++){
       lft = Q[i].l;
       rgt = Q[i].r;
      while(cl<lft){
        Remove(cl),cl++;
      }
      while(cl>lft){
        Add(cl-1),cl--;
      } 
      while(cr<=rgt){
        Add(cr),cr++;
      }
      while(cr>(rgt+1)){
        Remove(cr-1),cr--;
      }
      ans[Q[i].idx]= dis;
    }
    for(int i=0;i<q;i++)cout << ans[i]<<'\n';
  return 0;
} 

Measured memory_bytes: 27248
#include <stdio.h>
#define FALSE 0
#define TRUE 1

int main(){
	int n,m,l;
	int i,j,k;
	int a[100][100]={},b[100][100]={};
	long c[100][100]={};
	int p;
	
	//??\???
	//n m l
	do{
		printf("");
		scanf("%d %d %d",&n,&m,&l);
	}while(!(n>=1 && n<=100 && m>=1 && m<=100 && l>=1 && l<=100));
	//a[n][m]
	for(i=0;i<n;i++){
		do{
			p=TRUE;
			printf("");
			for(j=0;j<m;j++){
				scanf("%d ",&a[i][j]);
				if(!(a[i][j]>=0 && a[i][j]<=10000))p=FALSE;
			}
		}while(p==FALSE);	
	}
	//b[m][l]
	for(i=0;i<m;i++){
		do{
			p=TRUE;
			printf("");
			for(j=0;j<l;j++){
				scanf("%d ",&b[i][j]);
				if(!(b[i][j]>=0 && b[i][j]<=10000))p=FALSE;
			}
		}while(p==FALSE);
	}
	
	//??????
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			for(k=0;k<m;k++){
				c[i][j]+=a[i][k]*b[k][j];
			}
		}
	}
	
	//??????
	for(i=0;i<n;i++){
		for(j=0;j<l;j++){
			if(j==l-1){
				printf("%ld\n",c[i][j]);
			}else{
				printf("%ld ",c[i][j]);
			}
		}
	}
	
	
	
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;
int main(){
    string str;
 
    map<string,string> encode;
    map<string,string> decode;
 
    encode[" "] = "101";
    encode["'"] = "000000";
    encode[","] = "000011";
    encode["-"] = "10010001";
    encode["."] = "010001";
 
    encode["?"] = "000001";
    encode["A"] = "100101";
    encode["B"] = "10011010";
    encode["C"] = "0101";
    encode["D"] = "0001";
    encode["E"] = "110";
    encode["F"] = "01001";
    encode["G"] = "10011011";
 
    encode["H"] = "010000";
    encode["I"] = "0111";
    encode["J"] = "10011000";
    encode["K"] = "0110";
    encode["L"] = "00100";
    encode["M"] = "10011001";
    encode["N"] = "10011110";
 
    encode["O"] = "00101";
    encode["P"] = "111";
    encode["Q"] = "10011111";
    encode["R"] = "1000";
    encode["S"] = "00110";
    encode["T"] = "00111";
    encode["U"] = "10011100";
 
    encode["V"] = "10011101";
    encode["W"] = "000010";
    encode["X"] = "10010010";
    encode["Y"] = "10010011";
    encode["Z"] = "10010000";
 
    decode["00000"] = "A";
    decode["00001"] = "B";
    decode["00010"] = "C";
    decode["00011"] = "D";
    decode["00100"] = "E";
    decode["00101"] = "F";
    decode["00110"] = "G";
 
    decode["00111"] = "H";
    decode["01000"] = "I";
    decode["01001"] = "J";
    decode["01010"] = "K";
    decode["01011"] = "L";
    decode["01100"] = "M";
    decode["01101"] = "N";
 
    decode["01110"] = "O";
    decode["01111"] = "P";
    decode["10000"] = "Q";
    decode["10001"] = "R";
    decode["10010"] = "S";
    decode["10011"] = "T";
    decode["10100"] = "U";
 
    decode["10101"] = "V";
    decode["10110"] = "W";
    decode["10111"] = "X";
    decode["11000"] = "Y";
    decode["11001"] = "Z";
 
    decode["11010"] = " ";
    decode["11011"] = ".";
    decode["11100"] = ",";
    decode["11101"] = "-";
    decode["11110"] = "'";
    decode["11111"] = "?";
 
    while(getline(cin,str)){
 
        string enc="";
        for(int i=0;i<str.size();i++){
            enc+=encode[str.substr(i,1)];
        }
 
        enc+="0000";
 
        string dec="";
        for(int i=0;i+5<=enc.size();i+=5){
            dec+=decode[enc.substr(i,5)];
        }
 
        cout << dec << endl;
    }
 
}

Measured memory_bytes: 1212
//泥臭いなあ
#include <iostream>
#include <cstdio>

int main()
{
        using namespace std;
        long int a,b;
        unsigned long int div;

        while(cin>>a>>b){

        div = (a+b)/10;

        if(div == 0)cout <<1<<"\n";
        else if(1 <= div && div <= 9)cout <<2<<"\n";
        else if(10 <= div && div <= 99)cout <<3<<"\n";
        else if(100 <= div && div <= 999)cout <<4<<"\n";
        else if(1000 <= div && div <= 9999)cout <<5<<"\n";
        else if(10000 <= div && div <= 99999)cout <<6<<"\n";
        else if(100000 <= div && div <= 200000)cout <<7<<"\n";
        }

        return 0;
}

Measured memory_bytes: 1168
#include "bits/stdc++.h"

using namespace std;

const int mx = 200000 + 9;

bitset <mx> mark;
int d[mx];
vector <int> adj[mx];

int main() {
    int n, m; cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    mark[1] = 1;
    queue <int> q;
    q.push(1);

    while (!q.empty()) {
        auto u = q.front();
        q.pop();
        for (auto v : adj[u]) {
            if (mark[v]) continue;
            mark[v] = 1;
            d[v] = 1 + d[u];
            q.push(v);
        }
    }

    if (d[n] == 2) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 16028
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N;
    cin >> N;
    vector<int>A(N+1);
    vector<int>B(N);
    for(int i = 0; i < N+1; i++) {
        cin >> A[i];
    }
    for(int i = 0; i < N; i++) {
        cin >> B[i];
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        if (A[i] <= B[i]) {
			ans += A[i];
            B[i]-= A[i];
		}
		else {
			ans += B[i];
            B[i] = 0;
		}
		if (A[i+1] <= B[i]) {
			ans += A[i+1];
            A[i+1] = 0;
		}
		else {
			ans+=B[i];
            A[i+1]-=B[i];
		}
    }
    cout << ans << endl;
}

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

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

    ll t = b / x;
    ll k = -1;
    if(a > 0){
        k = (a - 1) / x;
    }

    cout << t - k << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
    string a,b;
    string s[101];
    cin>>a>>b;
    int i;
    for(i=0;i<a.length();i++){
        s[i].assign(a,i,a.length());
        for(int j=0;j<i;j++){
            s[i]+=a[j];
        }
        if(s[i]==b){
            cout<<"Yes"<<endl;
            break;
        }
    }
    if(i==a.length()) cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main(){
 ll d ; cin>> d ;
 ll c[26] ; rep(i,26) cin>>c[i] ;
 ll s[d][26] ;
 vector<ll> t(d) ;
 vector<ll> ans(d) ;
 rep(i,d){
     rep(j,26){
        cin>> s[i][j] ;
        if(t[i]<s[i][j]){
            t[i]= s[i][j] ;
            ans[i]= j;
        }
     }
 }


ll k = ans[0] ;
 rep(i,d){
     cout<< ((k+i)%26) +1 << endl ;
 }
 return 0 ; 
}



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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int L;
    Scd(L);
    vi pre(L);
    L--;

    int N = 0,M = 0;
    int ni = 1;
    int ew = 1;
    vector<vii> e(25);
    while( ni < 19 && ew*2-1 <= L ){
        e[ni].push_back({ni+1,ew});
        e[ni].push_back({ni+1,0});
        M+=2;
        ew *= 2; ni++;
    }
    N = ni+1;

    while( L >= 0 ){
        if( L >= ew-1 ){
            e[ni].push_back({N,L-ew+1});
            M++;
            L -= ew;
        }else{
            ew /= 2; ni--;
        }
    }

    printf ("%d %d\n", N, M);
    Rep(i,21){
        for( pii p : e[i] ){
            printf ("%lld %d %d\n", i, p.first, p.second );
        }
    }

    stack<pii> s;
    s.push({1,0});
    while(s.size()){
        int from = s.top().first;
        int dis = s.top().second;
        s.pop();
        if( from == N ){
            if( pre[dis] ) printf ("!!!\n");
            pre[dis]++;
        }
        for( pii t : e[from] ){
            int to = t.first;
            int ddis = dis + t.second;
            s.push({to,ddis});
        }
    }
    for( int t : pre ){
        if( t==0 ) printf ("!!!\n");
    }

    return 0;
}



Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;
 
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
 
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main(void){
    int N,M;
    cin>>N>>M;
    vector<pair<ll,ll>> P(N);
    for (int i=0;i<N;i++) {
        ll a,b;
        cin>>a>>b;
        P[i] = make_pair(a,b);
    }
    sort(P.begin(),P.end());
    ll ans = 0;
    for (int i=0;i<N;i++) {
        if (P[i].second < M) {
            M -= P[i].second;
            ans += P[i].first*P[i].second;
        }
        else {
            ans += M*P[i].first;
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <vector>

struct union_find {
    using size_type = std::size_t;
private :
    size_type _size;
    std::vector<int> node;
public :
    union_find (size_type n) : node(n, -1), _size(n) { }

    bool unite (size_type x, size_type y) {
        if ((x = root(x)) == (y = root(y))) return false;
        if (node[x] > node[y]) std::swap(x, y);
        node[x] += node[y];
        node[y] = x;
        _size--;
        return true;
    }

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

    size_type root (size_type x) {
        if (node[x] < 0) return x;
        return node[x] = root(node[x]);
    }

    size_type size (size_type x) {
        return (size_type(-node[root(x)]));
    }

    constexpr const size_type &size () const noexcept {
        return _size;
    }

};

#include <iostream>
#include <vector>
#include <cassert>

using usize = std::size_t;
constexpr long long INF = (1LL << 60);

template<class T>
void chmax (T &a, const T &b) {
	if (a < b) a = b;
}

int main() {
	usize n, k;
	std::cin >> n >> k;
	std::vector<usize> p(n);
	std::vector<long long> c(n);
	for (auto &e : p) std::cin >> e;
	for (auto &e : c) std::cin >> e;
	
	union_find uf(n);
	std::vector<usize> sz(n);
	std::vector<long long> sum[n];
	std::vector<long long> loop(n, 0);
	for (usize i = 0; i < n; i++) uf.unite(i, --p[i]);
	for (usize i = 0; i < n; i++) {
		sz[i] = uf.size(i);
		sum[i].assign(sz[i] + 1, 0);
		loop[uf.root(i)] += c[i];
	}

	long long ans = -INF;
	for (usize s = 0; s < n; s++) {
		loop[s] = loop[uf.root(s)];
		for (usize v = s, i = 0; i < sz[s]; i++, v = p[v]) if (k >= i + 1) {
			sum[s][i + 1] = sum[s][i] + c[p[v]];
			usize t = (k - i - 1) / sz[s];
			chmax(ans, sum[s][i + 1] + std::max<long long>(0LL, loop[s] * t));
		}
	}
	
	std::cout << ans << '\n';
	
	return 0;
}

Measured memory_bytes: 199312
N,M = map(int,input().split())
S = input()
T = input()


def gcd(x,y):
    z = x % y
    if z==0:
        return y
    else:
        return gcd(y,z)
    
def lcm(x,y):
    return x*y//gcd(x,y)

L = lcm(N,M)
m1 = L // N
m2 = L // M
mlcm = lcm(m1,m2)
idx = 0
flag = True
while True:
    sid = mlcm*idx//m1
    tid = mlcm*idx//m2
    if sid >= N or tid >= M: break    
    if S[sid] != T[tid]:
        flag = False
        break
    idx += 1

if flag:
    print(L)
else:
    print(-1)

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

signed main(){

  int h,w;
  cin>>h>>w;
  vector<string> s(h);
  for(auto& si:s)cin>>si;

  vector<vector<int>> visited(h,vector<int>(w,0));
  using P = pair<int,int>;
  queue<P> que;
  que.emplace(0,0);
  while(!que.empty()){
    int y,x;
    tie(y,x) = que.front();
    que.pop();
    if(y==h||x==w)continue;
    if(s[y][x]=='.')continue;
    visited[y][x] = 1;
    if(x+1<w&&s[y][x+1]=='#')que.emplace(y,x+1);
    else que.emplace(y+1,x);
  }
  bool ok = true;
  for(int i=0;i<h;++i)for(int j=0;j<w;++j){
    if(s[i][j]=='#'){
      if(visited[i][j]==0)ok=false;
    }
  }
  cout<<(ok?"Possible":"Impossible")<<endl;

}

Measured memory_bytes: 256
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys
import itertools

# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

S = readline().decode('utf8').rstrip()

f0 = S[::2].count('0') + S[1::2].count('1')
f1 = S[::2].count('1') + S[1::2].count('0')
print(min(f0, f1))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    lint n, k;
    cin >> n >> k;
    vector<lint> a(n), f(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> f[i];
    }
    sort(all(a), greater<lint>());
    sort(all(f));
    //範囲を(left,right]で管理
    lint left = -1, right = 1e+12;
    while (right - left > 1) {
        lint need = 0;
        lint mid = (left + right) / 2;
        for (int i = 0; i < n; i++) {
            // temp:必要なマンパワー
            lint temp = mid / f[i];
            need += max(a[i] - temp, (lint)0);
        }
        if (need <= k) {
            right = mid;
        } else {
            left = mid;
        }
    }
    cout << right << endl;
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back

#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define output_s(a) printf("%s\n",(a).c_str())

//library----------------------------------------------


int main(){
    int L;cin>>L;
    double x;
    x = (double)L/3;
    long double ans = (double)x*x*x;
    cout<<setprecision(10)<<fixed<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
const double inf=1e8;	
int main(){
	int n,m,r;
	cin>>n>>m>>r;
	vi a(m);
	rep(i,m)cin>>a[i];
	map<int,int>ma;
	rep(i,m)ma[a[i]]=i+1;
	vvi in(n,vi(r));
	rep(i,n)rep(j,r)cin>>in[i][j];
	int N=1<<m;
	vi dp(N,inf);
	dp[N-1]=0;
	queue<int>q;
	q.push(N-1);
	while(!q.empty()){
		int b=q.front();q.pop();
		rep(k,r){
			int w=0;
			rep(i,m)if(b&1<<i&&ma[in[a[i]-1][k]])w|=1<<(ma[in[a[i]-1][k]]-1);
			if(dp[w]>dp[b]+1){
				dp[w]=dp[b]+1;
				q.push(w);
			}
		}
	}
	cout<<dp[0]<<endl;
}

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

using namespace std;

#define REP(var, n)  for (decltype(n) var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<decltype(var)>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

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

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


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


template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

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

auto solve() {
    int N;
    cin>>N;
    vi A(N);
    for(auto&&e:A) cin>>e;
    int g = gcd(A[0], A[1]);
    FOR(i,2,N) {
        g = gcd(g,A[i]);
    }

    return g;
}


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

//    cout << (solve() ? "First" : "Second") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define precision(n) cout << fixed << setprecision(n);
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
    int n;
    cin>>n;
    // vector<int>v;
    int a[n];
    for(int i=0; i<n; i++)
    {
        cin>>a[i];

    }
    int ans=0;
    int cnt=0;
    for(int i=0;i<n-1;i++)
    {
        if(a[i]>=a[i+1])
        {
            cnt++;
            ans=max(ans,cnt);
        }
        else
        {
        // ans=max(ans,cnt+1);
         cnt=0;
        }
    }
    cout<<ans<<endl;
    return 0;
}




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

priority_queue<double> P;
int main(){
	int n;
	cin>>n;
	double x;
	for(int i=0;i<n;i++){
		cin>>x;
		P.push(-x);
	}
	for(int i=1;i<n;i++){
		x=P.top();P.pop();
		double y;
		y=P.top();P.pop();
		P.push((x+y)/2.);
	}
	cout<<-P.top();
	
	return 0;
}

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

int main(){
	int n;
	cin>>n;
	long long ans=0;
	vector<vector<long long>>dist(n,vector<long long>(n,1e12));
	bool flag[300][300]={};
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			cin>>dist[i][j];
			ans+=dist[i][j];
		}
	}
	long long minus=0;
	for(int k=0;k<n;++k){
		for(int i=0;i<n;++i){
			for(int j=0;j<n;++j){
				if(dist[i][k]+dist[k][j]<=dist[i][j]){
					if(dist[i][k]+dist[k][j]==dist[i][j]){
						if(dist[i][k] && dist[k][j]){
							flag[i][j]=true;
						}
					}
					else{
						cout<<"-1"<<endl;
						return 0;
					}
				}
			}
		}
	}
	for(int i=0;i<n;++i){
		for(int j=0;j<n;++j){
			if(flag[i][j])minus+=dist[i][j];
		}
	}
	cout<<(ans-minus)/2<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD = 1000000007;

     signed main(){
    int n,t=0;
    cin>>n;
   string x;
   cin>>x;
   int p1[n]={},p2[n]={},q1=0,q2=0,z1=1,z2=1;
    for(int i=0;i<n;i++)if(x[i]=='1')t++;
    for(int i=n-1;i>=0;i--){
        if(x[i]=='1'){p1[i]=z1;p2[i]=z2;}
        q1+=p1[i];q2+=p2[i];
        z1=z1*2%(t+1);
        if(t!=1)z2=z2*2%(t-1);
        else z2=-1;
    }
    z1=1;z2=1;int ans[n];
    for(int i=n-1;i>=0;i--){
       if(x[i]=='0'){
           //cerr<<z1<<' '<<q1;
           ans[i]=(z1+q1)%(t+1);
       }else{
           if(t==1)ans[i]=-1;
           else ans[i]=(q2 +(t-1)-z2 )%(t-1);
       }
        z1=z1*2%(t+1);
        if(t!=1)z2=z2*2%(t-1);
        else z2=-1;
        
    }
    for(int i=0;i<n;i++){
        if(ans[i]==-1){
            cout<<0<<endl;
            continue;
        }
        int t=1;
        while(ans[i]!=0){
           // cerr<<ans[i]<<' ';
            int k=0;
            for(int j=0;(1ll<<j)<=ans[i];j++)if((1ll<<j)&ans[i])k++;
            ans[i]%=k;
            t++;
          //  cerr<<endl;
        }
        cout<<t<<endl;
    }

     }


 


 






    





      

        


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

using namespace std;

int N, x, y, ans[2010];

int main() {
	cin >> N >> x >> y;
	for (int i = 1; i <= x; i++)
		for (int j = i + 1; j <= x; j++) ans[j - i]++;
	for (int i = y; i <= N; i++)
		for (int j = i + 1; j <= N; j++) ans[j - i]++;
	for (int i = x + 1; i < y; i++)
		for (int j = i + 1; j < y; j++) ans[min(j - i, i - x + y - j + 1)]++;
	for (int i = 1; i <= x; i++)
		for (int j = x + 1; j < y; j++) ans[min(j - i, y - j + 1 + x - i)]++;
	for (int i = y; i <= N; i++)
		for (int j = x + 1; j < y; j++) ans[min(i - j, j - x + 1 + i - y)]++;
	for (int i = 1; i <= x; i++)
		for (int j = y; j <= N; j++) ans[j - y + x - i + 1]++;
	for (int i = 1; i < N; i++) cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 256
use std::io;
use std::cmp;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;

fn read_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}


fn main() {
    let line: Vec<usize> = read_line().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let x = line[0] as f64;
    let y = line[1] as f64;
    let a = line[0];
    let b = line[1];
    let c = line[2];
    let d = line[3];
    let ans = if c * 2 == a && d * 2 == b {
        1
    } else {
        0
    };

    println!("{:.10} {}", x * y / 2.0, ans);
}


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

int main(){
    string s; cin >>s;
    if(s=="SUN") cout << 7<< endl;
    if(s=="MON") cout << 6<< endl;
    if(s=="TUE") cout << 5<< endl;
    if(s=="WED") cout << 4<< endl;
    if(s=="THU") cout << 3<< endl;
    if(s=="FRI") cout << 2<< endl;
    if(s=="SAT") cout << 1<< endl;
}

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

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define print(n) cout << n << endl

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    ll n,x,y;
    cin >> n >> x >> y;
    x--; y--;
    vector<ll> a(n-1,0);
    ll dist;
    rep(i,n-1) for(ll j = i+1; j < n; j++){
        dist = min(j-i,abs(i-x)+1+abs(j-y));
        a[dist-1]++;
    }
    rep(i,n-1) print(a[i]);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//pow(llpow,modpow)
template<class T> long long llpow(long long x,T n){long long ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    ll n;
    cin>>n;
    ll sum=0;
    vll dum(n); rep(i,0,n)cin>>dum[i];
    rep(i,0,n)sum+=dum[i];
    ll sumrm0=0;
    rep(i,0,n){
        if(i%2)sumrm0+=2*dum[i];
    }
    vll res(n,0);
    res[0]=sum-sumrm0;
    rep(i,0,n-1){
        res[i+1]=2*dum[i]-res[i];
    }
    rep(i,0,n)cout<<res[i]<<" ";
    cout<<endl;
    return 0;
}




Measured memory_bytes: 2944
#include<iostream>
using namespace std;
int primes[200000];
bool is(int n){
	for(int i=2;i*i<=n;i++)if(n%i==0)return false;
	return true;
}
int main(){
	int cnt=0,ii=2;
	while(true){
	if(cnt==200000)break;
	if(is(ii)){
	primes[cnt]=ii;
	cnt++;
	}
	ii++;
	}
	int n;
	//for(int i=0;i<20;i++)cout<<primes[i]<<" ";cout<<endl;
	while(true){
	cin>>n;
	if(n==0)break;
	bool f=0,f2=0;
	int a,b;
	for(int i=0;i<200000;i++){
	if(n==primes[i]){
	f2=1;
	continue;
	}
	if(n>primes[i])a=primes[i];
	if(n<primes[i]&&f==0){
	b=primes[i];
	f=1;
	}
	}
	if(f2||n<=2)cout<<0<<endl;
	else cout<<b-a<<endl;
	}
	return 0;
}

Measured memory_bytes: 1940
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(int i=0;i<n;i++)
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

ll Power(ll base , ll e)
{
    if(e == 0) return 1;
    ll ans = base; e--;
    while(e)
    {
        if(e & 1) ans = (ans * base) ;
        base = (base * base);
        e >>= 1;
    }
    return ans ;
}

int main(){
 IOS
   ll h;
   cin>>h;
   ll power=0;
   ll temp=h;
   ll ans=0;
   ll cnt=1;
   while(temp!=0){
     ans=ans+1*Power(2,power);
     power++;
     
     //cout<<"   "<<ans<<endl;
     temp=temp/(ll)2;

   }
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    string S;
    cin >> S;
    int n = S.length();
    ll dp[20][2] = {};
    dp[0][0] = 0;
    REP(i, n){
        REP(h, 10){
            if((S[i]-'0')==h) chmax(dp[i+1][0], dp[i][0]+h);
            if(h<(S[i]-'0')) chmax(dp[i+1][1], dp[i][0]+h);

            if(i!=0) chmax(dp[i+1][1], dp[i][1]+h);
        }
    }
    pr(max(dp[n][1], dp[n][0]));
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
using namespace std;
int main()
{
    int m,n,k;int a[101];
    cin>>n>>m>>k;
    int t=min(n,m);int j=0;
    for(int i=1;i<=t;i++)
    {
        if(n%i==0&&m%i==0)
            a[j++]=i;
    }
    sort(a,a+j);
    cout<<a[j-k];
}


Measured memory_bytes: 256
//in the name of god
#include <bits/stdc++.h>
using namespace std;
#define MAX_N (int)1e6+20
#define INF 1e18+20
#define pb push_back
#define F first
#define S second
#define lch(A) (A)<<1
#define rch(A) ((A)<<1)|1
#define par(A) (A)>>1
typedef  long long LL;
typedef pair<int,int> pii;
const int delta=(LL)1e9+7;
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int x,y;
	cin>>x>>y;
	if(x%y==0) cout<<-1;
	else cout<<x;
	return cout<<endl,0;
}

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

int main(){
  int x,S[100],i=0;
  char s[100];

  for(i=0;scanf("%s", s) != EOF; ){

    if ( s[0] == '+' ){
      S[i-2]=S[i-2]+S[i-1];
      i--;
    } else if ( s[0] == '-' ){
      S[i-2]=S[i-2]-S[i-1];
      i--;
    } else if ( s[0] == '*' ){
      S[i-2]=S[i-2]*S[i-1];
      i--;
    } else {
      x = atoi(s);
      S[i]=x;
      i++;
    }
  }
  printf("%d\n",S[i-1]);
  return 0;
}

Measured memory_bytes: 548