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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int q;
    cin >> q;
    vector< int > v;
    for( int i = 0; i < q; ++i ) {
        int seq;
        cin >> seq;
        if( seq == 0 ) {
            int x;
            cin >> x;
            v.pb(x);

        }
        if( seq == 1 ) {
            int p;
            cin >> p;
            cout << v[p] << endl;

        }
        if( seq == 2 ) {
            v.pop_back();

        }
    }
    return 0;
}




Measured memory_bytes: 3952
#include<bits/stdc++.h>
using namespace std;
long long dp[100001],v[101],w[101];
int main()
{
    int n,W;
    cin>>n>>W;
    for(int i=0;i<n;i++)
        cin>>w[i]>>v[i];
    /*for(int i=0;i<n;i++)
    {
        for(int j=0;j<=W;j++)
        {
            if(w[i]>j)
                dp[(i+1)&1][j]=dp[i&1][j];
            else
                dp[(i+1)&1][j]=max(dp[i&1][j],dp[i&1][j-w[i]]+v[i]);
        }
    }*/
    for(int i=0;i<n;i++)
    {
        for(int j=W;j>=0;j--)
        {
            if(w[i]>j)
                break;
            dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
        }
    }
    //cout<<dp[n&1][W]<<endl;
    cout<<dp[W]<<endl;
    return 0;
}


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

int main() {
  int N;
  scanf("%d", &N);
  int64_t b[87];
  b[0]=2LL;
  b[1]=1LL;
  for (int i = 2; i<=N; i++) {
    b[i] = b[i-2] + b[i-1];
  }
  printf("%ld\n", b[N]);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int[][] bingo = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                bingo[j][i] = scanner.nextInt();
            }
        }

        final boolean[][] isRead = new boolean[3][3];
        final int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            final int b = scanner.nextInt();
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 3; k++) {
                    if (b == bingo[j][k]) {
                        isRead[j][k] = true;
                    }
                }
            }
        }

        if (isRead[0][0]) {
            if (isRead[0][1] && isRead[0][2]
                    || isRead[1][1] && isRead[2][2]
                    || isRead[1][0] && isRead[2][0]) {
                System.out.println("Yes");
                return;
            }
        }

        if (isRead[0][1]) {
            if (isRead[1][1] && isRead[2][1]) {
                System.out.println("Yes");
                return;
            }
        }

        if (isRead[0][2]) {
            if (isRead[1][2] && isRead[2][2]
                    || isRead[1][1] && isRead[2][0]) {
                System.out.println("Yes");
                return;
            }
        }

        if (isRead[1][0]) {
            if (isRead[1][1] && isRead[1][2]) {
                System.out.println("Yes");
                return;
            }
        }

        if (isRead[2][0]) {
            if (isRead[2][1] && isRead[2][2]) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}


Measured memory_bytes: 23636
n=int(input())
a=list(map(int,input().split()))
count=1
x=max(a)
import collections
c=collections.Counter(a)
if a[0]!=0 or c[0]!=1:
  print(0)
  exit()
else:
  b=[1]*(x+1)
  for i in range(1,x+1):
    count=(count*(b[i-1]**c[i]))%998244353
    b[i]=c[i]
  print(count)

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

int main () {

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

	map <string, int> freq;
	int n;
	cin >> n;
	int maxfreq = 0;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;

		freq[s]++;
		maxfreq = max (maxfreq, freq[s]);
	}

	for (map <string, int> :: iterator it = freq.begin(); it != freq.end(); ++it) {
		if (it -> second == maxfreq)
			cout << (it -> first) << '\n';
	}

	return 0;
}

Measured memory_bytes: 23808
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

//Nayeem Shahriar Joy,Applied Physics And Electronic Engineering,University of Rajshahi.

int main(void)

{
    vector<int>p;

    int a;

    int w=5;

    while(w--)

    {
        cin>>a;
        p.push_back(a);
    }

    sort(p.begin(),p.end());

    int count=0;

    for(int i=p.size()-1;i>=0;i--)
    {
        count++;
        if(count==p.size())
        {
            cout<<p[i]<<endl;
        }
        else{
        cout<<p[i]<<" ";
        }
    }
    return 0;
}

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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main() {
    char c; cin >> c;
    char b[] = {'a','i','u','e','o'};
    cout << (count(b, b+5, c) ? "vowel" : "consonant") << endl;
}

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

ball = list(map(int,input().split()))

ans = []

count = 0

while len(ball)>0:
    count += 1
    for i in range(len(ball)-1,-1,-1):
        #print(ball,i)
        if i+1 ==ball[i]:
            move = ball.pop(i)
            ans.insert(0,move)
            break
    if count ==100000:
        break
    

if len(ans) == n:
    for i in ans:
        print(i)
else:
    print(-1)

Measured memory_bytes: 40428
N, A = [int(_) for _ in input().split()]
x = [int(i)-A for i in input().split()]

dp = [[0 for j in range(100 * N + 1)] for i in range(N + 1)]
dp[0][50 * N] = 1

for i in range(N):
    for j in range(50, 100 * N + 1 - 50):
        dp[i + 1][j] = dp[i][j] + dp[i][j - x[i]]
        
print(dp[N][50 * N] - 1)

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,a,b=0,c=0;
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>a;
		if(a%2==0){
			b++;
		}else{
			c++;
		}
	}
	if(c%2==0){
		if(b>=1 &&c>=2){
			cout<<"YES"<<endl;
		}else if(b==0 && c>=2){
			cout<<"YES"<<endl;
		}else if(b>=1 && c==0){
			cout<<"YES"<<endl;
		}
	}else{
		if((b==1 && c==0) || (b==0&&c==1)){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	return 0;
}


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

int main()
{
  int n,a,b,c,d;
  cin>>n;
  a=n%10;
  b=(n%100)/10;
  c=(n%1000)/100;
  d=n/1000;

  if((a==b&&b==c)||(b==c&&c==d))
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	set<string> st;
	string s;
	for(int i=1;i<=n;i++)
	{
		cin>>s;
		st.insert(s);
	}
	cout<<sz(st)<<"\n";
	return 0;
}

Measured memory_bytes: 19212
def cross(a: complex, b: complex) -> float:
    return float(a.real * b.imag - a.imag * b.real)


def cross_point(p1: complex, p2: complex, p3: complex, p4: complex) -> complex:
    base = p4 - p3
    hypo1 = p1 - p3
    hypo2 = p2 - p3
    d1 = abs(cross(base, hypo1)) / abs(base)
    d2 = abs(cross(base, hypo2)) / abs(base)
    cross_point = p1 + d1 / (d1 + d2) * (p2 - p1)
    return cross_point


if __name__ == "__main__":
    q = int(input())
    for _ in range(q):
        x_p0, y_p0, x_p1, y_p1, x_p2, y_p2, x_p3, y_p3 = map(lambda x: int(x),
                                                             input().split())
        p0 = complex(x_p0, y_p0)
        p1 = complex(x_p1, y_p1)
        p2 = complex(x_p2, y_p2)
        p3 = complex(x_p3, y_p3)

        ans = cross_point(p0, p1, p2, p3)
        print(f"{ans.real} {ans.imag}")



Measured memory_bytes: 5660
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <regex>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;
const int INF = 2147483647;

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//myfuncs
//素数判定
template<class T> inline T isPrime(T x) {
	bool ret = true;
	if (x < 2) {
		ret = false;
	}
	for (LL i = 2; i <= sqrt(x); i++) {
		if (x%i == 0) {
			ret = false;
		}
	}
	return ret;
}

//Union FInd
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//main code

int main(int argc, char const* argv[])
{
    int n;
    cin >> n;
    VI x(n+1,0);
    VI t(n+1,0);
    for (int i = 1; i < n+1; i++) {
        cin >> x[i];
        t[i] = x[i];
    }
    SORT(t);
    int left_c = t[n/2];
    int right_c = t[n/2+1];
    for (int i = 1; i < n+1; i++) {
        if (x[i] >= right_c) {
            cout << left_c << endl;
        }
        else {
            cout << right_c << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3712
fn main() {
    let n = read::<usize>();
    let p = read_vec::<usize>();

    let mut ret = 0;
    for i in 0..n - 2 {
        let p1 = p[i];
        let p2 = p[i + 1];
        let p3 = p[i + 2];
        if (p1 < p2 && p2 < p3) || (p1 > p2 && p2 > p3) {
            ret += 1;
        }
    }

    println!("{}", ret);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

Measured memory_bytes: 2108
// TO KAISE HAI AAP LOG!! //

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

#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define F first
#define S second
#define all(v) v.begin(),v.end()
ll mod=1e9+7;
 
/*/----------------------------- Code begins -----------------------------/*/

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll t=1,tc;
    //cin>>t;
    for(tc=1;tc<=t;tc++){
      ll n,k,i,j,s=1000,f,m,c,pos;
      cin>>n;
      ll a[n+5];
      for(i=0;i<n;i++)cin>>a[i];
      for(i=0;i<n-1;){
          f=0;
          m=a[i];
          j=i+1;
          while(j<n){
              if(a[j]>m){
                 f=1;
                 pos=j;
              break;
              }
              m=min(a[j],m);
              j++;
          }
          if(f==0)
           break;
          c=0;
          ll x=(s/m);
          s=s-(x*m);
          s=s+(x*a[pos]);
          i=j;
      }
      cout<<s;
    }
	return 0;
}

Measured memory_bytes: 3596
/*
	* Keep on coding, do not let yourself get distracted
	* Get your self be ready for any situation
	* Never let your self get easy
	* Gmail: nhatminh1803lqd@gmail.com
*/
#include <bits/stdc++.h>

#define bug "bug "
#define ii pair  < int, int >
#define iii pair < int, ii  >
#define iv pair  < ii , ii  >

#define fi first
#define se second

#define FOR(i , x , n)  for(int i = x; i <= n ; ++i)
#define REP(i , n)      for(int i = 0; i <  n ; ++i)
#define FORD(i , x , n) for(int i = x; i >= n ; --i)

#define ll long long
#define int long long

#define fast ios::sync_with_stdio(0);cin.tie(0);
#define eps 1e-9

using namespace std;

const int N = 1e5 + 10;
const int oo = 1e9 + 7;
const int MAXELEMENT = 1e6 + 10;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

int n;
int a[N], f[N];

main()
{
	fast;
	srand(time(NULL));
	//freopen ("Frog1.inp", "r", stdin);
	//freopen ("Frog1.out", "w", stdout);

	cin >> n;
	FOR(i, 1, n) {
		cin >> a[i];
	}

	FOR(i, 0, n + 1) {
		f[i] = oo;
	}
	f[1] = 0;
	f[2] = abs(a[1] - a[2]);

	FOR(i, 3, n) {
		f[i] = min(f[i - 1] + abs(a[i - 1] - a[i]), f[i - 2] + abs(a[i - 2] - a[i]));
	}

	/* FOR(i, 1, n) {
		cout << f[i] << " ";
	}
	cout << endl; */

	cout << f[n] << endl;


}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
int main(void) {
	long long int n,m=10000000000000, i,k = 0,s=0;
	std::cin >> n;
	for (i = 1; i*i< n+1 ; i++) {
		if (n % i == 0) { 
			k = n / i;
			m = std::min((k - 1) + (i - 1),m);
			s++;
			//std::cout << i << std::endl;
		}
	}
	
	//std::cout << k << " " << i << " " << s << " " << n<< std::endl;
	std::cout << m << std::endl;
	return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    n, m = LI()
    print((n-1)*(m-1))
    return

#B
def B():
    s = S()
    print(s[0]+str(len(s)-2)+s[-1])
    return

#C
def C():
    II()
    a = LI()
    a1 = 0
    a2 = 0
    a3 = 0
    for ai in a:
        if not ai % 4:
            a3 += 1
            continue
        if not ai % 2:
            a2 += 1
            continue
        a1 += 1
    if a2:
        print(["No", "Yes"][a3 >= a1])
        return
    print(["No", "Yes"][a3 >= a1 - 1])
    return
    """
    n, m = LI()
    x = -1
    y = -1
    z = -1
    for i in range(n + 1):
        a = m - 9000 * i - 1000 * n
        if a % 4000 == 0 and a >= 0 and n - i - a / 4000 >= 0:
            y = a / 4000
            z = n - i - y
            x = i
            break
    print(int(x),int(y),int(z))
    """
#D
def D():
    return

#Solve
if __name__ == '__main__':
    C()


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

using namespace std;


int main(){
	int n, sum = 0, min;
	cin >> n;
	int p[n];	
	
	for(int i = 0; i < n; i++){
         cin >> p[i];
         if(i == 0) min = p[0];
         if(min >= p[i]){
			 min = p[i];
			 sum += 1;
		  }
	}
    cout << sum;
    return 0;
}
		
	


Measured memory_bytes: 1024
n=int(input())
A=[0]+list(map(int,input().split()))
B=[0]+list(map(int,input().split()))
C=[0]+list(map(int,input().split()))

ans=B[A[1]]
for i in range(2,n+1):
    ans+=B[A[i]]
    if A[i]==A[i-1]+1:
        ans+=C[A[i-1]]

print(ans)

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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define DUP(x, y) (((x) + (y) - 1) / (y))
#define YES puts("YES")
#define NO puts("NO")
#define Yes puts("Yes")
#define No puts("No")
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end())

using ll = std::int64_t;
using vint = std::vector<int>;
using vll = std::vector<ll>;
using vstr = std::vector<std::string>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    string s;
    cin >> s;

    rep(i, s.length()) {
        if (i % 2 == 1) {
            if (s[i] == 'R') {
                No;
                return;
            }
        }
        else {
            if (s[i] == 'L') {
                No;
                return;
            }
        }
    }
    Yes;

}

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



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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

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

int main()
{
    int n, x;
    cin >> n >> x;

    vector<int> a;
    a.push_back(x);
    rep(i, n)
    {
        int b;
        cin >> b;
        a.push_back(b);
    }

    sort(ALL(a));

    int g = a[1] - a[0];
    for (int i = 1; i < n; i++)
    {
        g = gcd(a[i + 1] - a[i], g);
    }

    OP(g);

    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
string s[16];
int dp[1<<14][14],n,d[14][14];
vector<int>v;
int ch(int y,int x){
  r(i,s[y].size()){
    int res=0,f=0;
    r(j,s[x].size()){
      if(j+i>=s[y].size())break;
      if(s[x][j]==s[y][i+j])res++;
      else f++;
    }
    if(!f){
      if(res==s[x].size())v.push_back(x);
      return res;
    }
  }
  return 0;
}
main(){
  while(cin>>n,n){
    int ans=0,p=0,r=0;
    v.clear();
    memset(d,0,sizeof(d));
    memset(dp,0,sizeof(dp));
    r(i,n)cin>>s[i],ans+=s[i].size();
    r(i,n)r(j,n)if(i!=j)d[i][j]=ch(i,j);
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    r(i,v.size()){
      ans-=s[v[i]-r].size();
      for(int j=v[i]-r;j<n;j++)s[j]=s[j+1];
      n--;r++;
    }
    r(i,n)r(j,n)if(i!=j)d[i][j]=ch(i,j);
    for(int i=1;i<(1<<n)-1;i++)r(j,n)
      if((1<<j)&i)r(k,n)if(((1<<k)&i)==0)
        dp[i|(1<<k)][k]=max(dp[i|(1<<k)][k],dp[i][j]+d[j][k]);
    r(i,n)p=max(p,dp[(1<<n)-1][i]);
    cout<<ans-p<<endl;
  }
}

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

int main(){
    int n;
    int a[1000];
    cin >> n;
    for(int i=0;i < n;i++){
        cin >> a[i];
    }
    cout << a[n-1];
    for(int i=1;i < n;i++){
        cout << " " << a[n-i-1];
    }
    cout << endl;
}


Measured memory_bytes: 3108
#include<iostream>
#include<algorithm>
#include <stdio.h>
using namespace std;
#define TREE_N (1<<17)

int ans,n,tree[ TREE_N * 2 -1];

void update(int i,int x){
  i+=TREE_N-1;
  tree[i]=x;
  while(i>0){
    i=(i-1)/2;
    tree[i]=min(tree[i*2+1],tree[i*2+2]);
  }
}

void rec(int a,int b,int k=0,int l=0,int r=TREE_N){
  if((l<a&&a<r)||(l<b&&b<r)){
    int m=(l+r)/2;
    rec(a,b,k*2+1,l,m);
    rec(a,b,k*2+2,m,r);
  }else if(a<=l&&r<=b){
    if(ans>tree[k])ans=tree[k];
  }
}

int main(){
  int q,com,a,b;
  cin>>n>>q;
  for(int i=0;i<n;i++)update(i,2147483647);
  for(int i=0;i<q;i++){
    cin>>com>>a>>b;
    if(com){
      ans=2147483647;
      rec(a,b+1);
      printf("%d\n",ans);
    }
    else update(a,b);
  }
  return 0;
}

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

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

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
   int A;
    int P;
    int m;
    cin>>A>>P;
    P=P+3*A;
   m=P/2;
    cout<<m<<endl;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/



Measured memory_bytes: 256
x,n = map(int, input().split())
seisuu_list = list(map(int, input().split()))
seisuu_list.sort()
if seisuu_list == []:
    print(x)
#print(seisuu_list)

for i in range(1,n+1):
    if i%2 != 0:
        i = -1*i
    #print(i)
    if x in seisuu_list:
        x += i
        if x in seisuu_list:
            continue
        else:
            print(x)
            exit()
    else:
        print(x)
        break

Measured memory_bytes: 9124
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

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

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

    int use[200010] {};

    vector<int> ans;

    for (int i = N; i >= 1; --i) {
        int sum = 0;
        for (int j = i; j <= N; j += i) sum += use[j];
        if (sum % 2 != a[i]) {
            use[i] = 1;
            ans.push_back(i);
        }
    }

    cout << ans.size() << "\n";
    for (int e : ans) cout << e << "\n";

    return 0;
}

// vim: set foldmethod=marker :


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

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
    int x;
    cin>>x;
    int a1=x/500;
    x=x%500;
    cout<<a1*1000+(x/5)*5<<endl;
}


return 0;
}





Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long k,a,b;
	scanf("%lld%lld%lld",&k,&a,&b);
	long long ans=k+1;
	if (a+1<=k){
		k-=a+1;
		ans=max(ans,b+k);
		
		if (b>a){
			ans=max(ans,b+(k/2)*(b-a)+(k%2)); 
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
n,m = map(int,input().split())
l = []
r = []
for i in range(m):
  t = tuple(map(int,input().split()))
  l.append(t[0])
  r.append(t[1])
l,r=max(l),min(r)
if l<=r:
  print(abs(l-r)+1)
else:
  print(0)

Measured memory_bytes: 11104
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;

int n;

int main()
{
	cin>>n;
	cout<<(int)((n+1)/2)<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)

int main() {
	string s;
	cin >> s;
	int halfsize = s.size() / 2;

	int pa = 0;
	for (auto ss : s) {
		if (ss == 'p') pa++;
	}

	cout << halfsize - pa << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<sstream>
#include<bitset>
#include<string>
#include<math.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int F[N][5][2];
    for(int i=0; i<N; i++){
        for(int j=0; j<5; j++){
            for(int k=0; k<2; k++){
                cin >> F[i][j][k];
            }
        }
    }

    int c[N][11];
    int tmp,ans;

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

    int count[N];
    stringstream ss;
    string s;

    for(long long ii=1; ii< (int) pow(2,10) ; ii++){
        ss << bitset<10>(ii);
        s = ss.str();
        ss.str("");

        int myshop[5][2];

        for(int i=0; i<5; i++){
            for(int j=0; j<2; j++){
                myshop[i][j]=(int) s[i*2+j]-'0';
            }
        }

        for(int i=0; i<N; i++){
            count[i]=0;
        }

        for(int i=0; i<N; i++){
            for(int j=0; j<5; j++){
                for(int k=0; k<2; k++){
                    if( myshop[j][k]==1 && F[i][j][k]==1 ){
                        count[i]++;
                    }
                }
            }
        }
        tmp=0;
        for(int i=0; i<N; i++){
            tmp+=c[i][count[i]];
        }
        //cout << s << " " << count[0] << " " << count[1] << " " << tmp << endl;
        if(ii==1){
            ans=tmp;
        }else{
            ans=max(tmp,ans);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 384
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! flush {
    () => {
        std::io::stdout().flush().unwrap();
    };
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let ps: Vec<_> = (0..n)
        .map(|_| {
            let x: f64 = sc.cin();
            let y: f64 = sc.cin();
            (x, y)
        })
        .collect();
    let mut dsum = 0.0;
    for i in 0..n {
        for j in 0..i {
            let d = (ps[i].0 - ps[j].0).hypot(ps[i].1 - ps[j].1);
            dsum += d;
        }
    }
    put!(dsum * 2.0 / n as f64);
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


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

int main() {
  int n;
  cin>>n; 
  vector<int> vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  cout<<vec.at(n-1)-vec.at(0)<<endl;
}

Measured memory_bytes: 256
//OPTIMIZATONS
#pragma GCC optimize("02")
//CODE
#include<bits/stdc++.h>
// uncomment the below code to use int as long long
#define int long long
// uncomment the below code to use float as double
//#define float double
#define endl "\n"
#define debug cout<<"Good uptill here"<<endl<<flush;
#define deb(x) cout<<#x<<":"<<x<<endl<<flush;

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	//CODE FOR SPECIFIED INPUT AND OUTPUT
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin>>n;
	int ans = 0;
	for(int i=1;i<=n;i++){
		for(int j=i;j<=n;j++){
			for(int k=j;k<=n;k++){
				int g = __gcd(i,j);
				g = __gcd(g,k);
				int res = 6;
				if(i==j && i==k) res/=6;
				else if(j==k) res/=2;
				else if(i==k) res/=2;
				else if(i==j) res/=2;
				ans += res*g;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
#define int long long
signed main()
{
    IOS
    int a,b;
    cin>>a>>b;
    int d = a+b,e = a-b,f = a*b;
    int ans = max(d,e);
    ans = max(ans,f);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc121/tasks/abc121_b

n, m, c = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
cnt = 0
for _ in range(n):
    a = [int(x) for x in input().split()]
    if sum([ea * eb for ea, eb in zip(a, b)]) + c > 0:
        cnt += 1
print(cnt)


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdint.h>
#include <list>

#ifdef DEBUG
#define DEBUG_LOG(fmt, ...)   printf(fmt, ##__VA_ARGS__)
#else
#define DEBUG_LOG(fmt, ...)
#endif

using namespace std;
int main()
{
    list<uint32_t> s_list;
    uint32_t n, i;

    scanf("%u", &n);
    for (i=0; i<n; i++) {
        uint32_t s;
        scanf(" %u", &s);
        s_list.push_back(s);
    }

    s_list.sort();

    uint32_t ans = 0;
    list<uint32_t>::iterator a, b, c;
    a = s_list.begin();
    for (a=s_list.begin(); a!=s_list.end(); ++a) {
        for (b=a, ++b; b!=s_list.end(); ++b) {
            for (c=b, ++c; c!=s_list.end(); ++c) {
                if ((*a + *b) > *c) {
                    ans++;
                    DEBUG_LOG("%u + %u > %u. so incremetn ans => %u\n",*a, *b, *c, ans);
                }
                else {
                    DEBUG_LOG("%u + %u <= %u. so not incremetn ans => %u\n",*a, *b, *c, ans);
                    break;
                }
            }
        }
    }
    printf("%u\n", ans);
    return 0;
}


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

public class Main {
	Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
	
	void run() {
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int a[] = new int[n];
		int cb[][] = new int[m][2];
		

		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		
		for(int i =0; i < m ;i++) {
			int b = sc.nextInt();
			int c = sc.nextInt();
			
			cb[i][0] = c;
			cb[i][1] = b;
		}
		
		Arrays.sort(a);
		Arrays.sort(cb, (arr1,arr2) -> - Integer.compare(arr1[0], arr2[0]));
		
		int b2[] = new int[n];
		
		int j = 0;
		for(int i = 0 ;i < m ;i++) {
			for(int k = 0; k < cb[i][1]; k++) {
				if(j >= n) {
					break;
				}
				b2[j] = cb[i][0];
				j++;
			}
			if(j>=n) {
				break;
			}
		}
		
		int c[] = new int[n+j];
		
		for(int x = 0; x < n ;x++) {
			c[x] = a[x];
		}
		for(int x = 0; x < j ; x++) {
			c[x+n] = b2[x];
		}
		
		Arrays.sort(c);
		
		long sum =0;
		
		for(int x = j ; x < n+j;x++) {
			sum += c[x];
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 100720
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
 
#define rep(n) for(int i=0; i<(n); i++)
#define pb(n) push_back((n))
 
//typedef long long ll;
 
using namespace std;

int gcd(int n,int m){
	//cout<<n<<" "<<m<<endl;
	if(n%m==0)return m;
	return gcd(m,n%m);
}

int x,y;

int main(){
	cin>>x>>y;
	cout<<gcd(x,y)<<endl;
}

Measured memory_bytes: 1160
Scanf.scanf "%d" (fun n ->
    let arr = Array.init 55556 (fun i -> if i < 2 then 0 else i) in
    let rec loop_i i =
        let rec loop_j j =
            if j <= 55555 then (arr.(j) <- 0; loop_j (j + i)) else loop_i (i + 1)
        in
        if i * i <= 55555 then loop_j (i * i)
    in
    loop_i 2;
    let q = Array.fold_right (fun v acc -> if v = 0 then acc else v :: acc) arr [] in
    let q = Array.of_list q in
    let rec loop rest i =
        if rest > 0 then (
            if q.(i) mod 5 = 1 then (
                Printf.printf "%d " q.(i);
                loop (rest - 1) (i + 1)
            ) else loop rest (i + 1)
        )
    in
    loop n 0;
    print_newline ()
)

Measured memory_bytes: 4428
#include<iostream> 
#include<vector> 
#include<algorithm> 
#include<iomanip> 
#include<stack> 
#include<unordered_map>
#include<queue> 
#include<map>
#include<climits>
#include<set> 
#include<string> 
//#include<bits/stdc++.h> 
using namespace std; 
#define lld long long int 
#define eb emplace_back
//to insert pair use eb
#define mp make_pair
#define fi first
#define se second
#define pb push_back

#define X 1000000007
#define Y 998244353
#define E4 10000
#define E5 100000
#define E6 1000000
#define inf 1001001001
#define longinf 2001001001001001001
#define pi 3.1415926535

# define rec2(i,a,b) for(lld i=a;i<b;i++) 
#define rec(i,n) for(lld i=0;i<n;i++)
#define rev(i,a,b) for(lld i=b-1;i>=a;i--)
#define all(v) (v).begin(), (v).end()
#define large(v)  *max_element(all(v))
#define small(v)  *min_element(all(v)) 
#define v vector
const double EPS = 1e-6;

void google(int i)
{  cout<<"Case #"<<i<<":"<<endl; }

//prime sieve if needed 
//prime factors of number
lld prime[E6+1]; 
void sieve(lld n) 
{ rec(i,n+1) 
    prime[i]=1; 
   for(lld i=2;i*i<=n;i++) 
     { if(prime[i]!=1) 
          continue; 
         for(lld j=i*i;j<=n;j=j+i) 
          if(prime[i]==1)
           prime[j]=i; 
      }
}

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

//fermat a^(m-2)%mod
lld binarymul(lld a,lld n,lld m)
{  lld res=1; 
 while(n) 
  { if(n%2) 
      { res=(res*a)%m; 
         n--; 
      } 
     a=(a*a)%m; 
     n/=2; 
  }
  return res; 
}
void contest(); 
int main()
{
   ios_base::sync_with_stdio(false); 
   cin.tie(0);
     #ifdef PUNEET_GOEL
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif
   //sieve(E6); 
    lld t; 
//    cin>>t; 
t=1; 
    rec(i,t) 
    {
     //google(i+1); 
      contest(); 
    }
	return 0;
}

void contest()
{ 
  lld n; 
  cin>>n; 
  if(n>=30) 
   cout<<"Yes"; 
   else 
   cout<<"No"; 
   cout<<endl; 
}

Measured memory_bytes: 3616
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(dead_code)]
pub const M: u64 = 1_000_000_007;

#[allow(unused_macros)]
macro_rules! vec_md {
    ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) };
    ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] };
    ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] };
}

fn main() {
    input! {
        h: usize, w: usize,
        a: [chars; h]
    }

    let mut dp = vec_md![0u64;h;w];
    dp[0][0] = 1;
    for y in 0..h {
        for x in 0..w {
            if y+1<h && a[y+1][x] == '.' {
                dp[y+1][x] += dp[y][x];
                dp[y+1][x] %= M;
            }
            if x+1<w && a[y][x+1] == '.' {
                dp[y][x+1] += dp[y][x];
                dp[y][x+1] %= M;
            }
        }
    }
    println!("{}", dp[h-1][w-1]);
}

Measured memory_bytes: 16636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <numeric>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007

int main()
{
    string s, t; cin >> s >> t;

    int cnt;
    int ans = t.size();
    for(int i = 0; i < s.size() - t.size() + 1; i++) {
        cnt = 0;
        int tmp = i;
        for(int j = 0; j < t.size(); j++) {
           
            if(s[i++] == t[j]) {
                cnt ++;
            }
        }

        i = tmp;

        ans = min(ans, (int)(t.size()) - cnt);
    }


    cout << ans << endl;
}

Measured memory_bytes: 3628
/*BY-ADITYA OJHA
  LEARN DSA SINCERELY*/
#include <bits/stdc++.h>
#define ll long long int
#define forin for(int i=0;i<n;i++)
#define forjn for(int j=0;j<n;j++)
#define pb push_back
#define vx vector<ll> x
#define fas1  ios_base::sync_with_stdio(false)
#define fas2   cin.tie(NULL)
using namespace std;


int main()
{
     fas1;
     fas2;
    ll n,a,b;
    cin>>n>>a>>b;
   if(a!=0)
    {
           if(n%(a+b)>a)
        cout<<a +((n/(a+b))*a)<<endl;
        else
            cout<<(n%(a+b)) +((n/(a+b))*a)<<endl;

    }

   else cout<<0<<endl;

     return 0;

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def main():
     n = int(input())
     matrix = [[0 for i in range(10)] for j in range(10)]
     ans = 0

     for i in range(1, n+1):
          s = str(i)
          first = int(s[0])
          end = int(s[-1])
          matrix[first][end] += 1
          # print(matrix)

     for i in range(1, 10):
          for j in range(1, 10):
               ans += matrix[i][j] * matrix[j][i]
               # print('{}, {}, {}'.format(i, j, ans))
     print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    string s,t;cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    int x=min(s.size(),t.size());
    rep(i,x){
        if(s[i]<t[i]){
            cout<<"Yes"<<endl;
            return 0;
        }else if(s[i]>t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s.size()<t.size())cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    int ans = H*W - (h*W + w*H - h*w);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;
ll Data[1000];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i,j,k,l,n,m;
    cin >> n;
    for (i = 1; i <= n;i++){
        cin >> Data[i];
    }
    ll sum = 1000;
    ll stock = 0;
    for (i = 1; i <= n;){
        for (j = i + 1; j <= n;j++){
            if(Data[j]<Data[j-1])
                break;
        }
        stock += (sum / Data[i]);
        sum = sum % Data[i];
        sum += (Data[j-1] * stock);
        stock = 0;
        for (k = j; k <= n;k++){
            if(Data[k]>Data[k-1])
                break;
        }
        i = max(j,k - 1);
    }
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 3648
using System;
using System.Collections.Immutable;
using System.Linq;

namespace AtCoder
{
    public class Solver
    {
        private readonly IInputReader _inputReader;
        private readonly IOutputWriter _outputWriter;

        public Solver(IInputReader inputReader, IOutputWriter outputWriter)
        {
            _inputReader = inputReader;
            _outputWriter = outputWriter;
        }

        public void Solve()
        {
            var numbers = _inputReader.ReadLine().ToIntArray().ToList();
            numbers.Sort();

            var result = numbers[0] == 5 && numbers[1] == 5 && numbers[2] == 7;

            _outputWriter.WriteLine(result ? "YES" : "NO");
        }
    }


    internal class Program
    {
        static void Main(string[] args)
        {
            var reader = new ConsoleInputReader();
            var writer = new ConsoleOutputWriter();
            new Solver(reader, writer).Solve();
        }
    }

    public interface IInputReader
    {
        string ReadLine();
    }

    public interface IOutputWriter
    {
        void WriteLine(string output);
    }

    internal class ConsoleInputReader : IInputReader
    {
        public string ReadLine() => Console.ReadLine();
    }

    internal class ConsoleOutputWriter : IOutputWriter
    {
        public void WriteLine(string output) => Console.WriteLine(output);
    }

    public static class StringExtensions
    {
        public static char ToChar(this string text) => text[0];
        public static int ToInt(this string text) => int.Parse(text);
        public static int[] ToIntArray(this string text) => text.Split(' ').Select(txt => txt.ToInt()).ToArray();
        public static long ToLong(this string text) => long.Parse(text);
        public static long[] ToLongArray(this string text) => text.Split(' ').Select(txt => txt.ToLong()).ToArray();
    }
}

Measured memory_bytes: 28288