akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
 
using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define rep(i,k,n) for (lli i = k; i <= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
 
typedef pair <lli,lli> pll;
 
 
lli countGreater(lli arr[], lli n, lli k) 
{ 
    lli l = 0; 
    lli r = n - 1; 
  
    // Stores the index of the left most element 
    // from the array which is greater than k 
    lli leftGreater = n; 
  
    // Finds number of elements greater than k 
    while (l <= r) { 
        lli m = l + (r - l) / 2; 
  
        // If mid element is greater than 
        // k update leftGreater and r 
        if (arr[m] > k) { 
            leftGreater = m; 
            r = m - 1; 
        } 
  
        // If mid element is less than 
        // or equal to k update l 
        else
            l = m + 1; 
    } 
  
    // Return the count of elements greater than k 
    return (n - leftGreater); 
}
 
bool is_palin(string input)
{
if (input == string(input.rbegin(), input.rend())) 
    return true;
return false;
}

void solve()
{
    lli n;
    cin>>n;
    cout<<ceil((n*2)/4.0);
}
 
int main()
{
    kira; 
    lli t=1; //cin>>t;
    while(t--)
    {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 256
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()
using lint = long long;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
inline int bitCount(int x) { return __builtin_popcount(x); }
inline int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	int N, L;
	cin >> N >> L;
	
	Vec< int > a;
	for (int i=0; i<N; ++i) a.push_back(L + i);
	int sum = accumulate(allof(a), int());
	
	int ans_diff = 1L << 30;
	int ans = 0;
	for (int i=0; i<N; ++i) {
		int b = sum - a[i];
		if (abs(sum - b) < ans_diff) {
			ans_diff = abs(sum - b);
			ans = b;
		}
	}
	cout << ans << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll n; cin >> n;
  fin(n / 10 == 9||n % 10 == 9?"Yes":"No")
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


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

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

int main()
{
    vector<vector<int>> c(3, vector<int>(3));
    rep(0, i, 3)
    {
        rep(0, j, 3)
        {
            cin >> c.at(i).at(j);
        }
    }

    rep(0, i, 2)
    {
        rep(0, j, 2)
        {
            if (c.at(j).at(i) - c.at(j).at(i + 1) != c.at(j + 1).at(i) - c.at(j + 1).at(i + 1))
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    rep(0, i, 2)
    {
        rep(0, j, 2)
        {
            if (c.at(i).at(j) - c.at(i + 1).at(j) != c.at(i).at(j + 1) - c.at(i + 1).at(j + 1))
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
package main

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

// define
var (
	sc = bufio.NewScanner(os.Stdin)
)

func bordersInt(in_map [][]int, invalid int) [][]int{
	H, W := len(in_map), len(in_map[0])
	out_map := make([][]int, H+2)
	for h:=0; h<H+2; h++ {
		out_map[h] = make([]int, W+2)
		for w:=0; w<W+2; w++ {
			out_map[h][w] = invalid
		}
	}
	for h:=0; h<H; h++{
		for w:=0; w<W; w++{
			out_map[h+1][w+1] = in_map[h][w] 
		}
	}
	return out_map
}

func bordersString(in_map [][]string, invalid string) [][]string{
	H, W := len(in_map), len(in_map[0])
	out_map := make([][]string, H+2)
	for h:=0; h<H+2; h++ {
		out_map[h] = make([]string, W+2)
		for w:=0; w<W+2; w++ {
			out_map[h][w] = invalid
		}
	}
	for h:=0; h<H; h++{
		for w:=0; w<W; w++{
			out_map[h+1][w+1] = in_map[h][w] 
		}
	}
	return out_map
}

func scanIntLine(len int) []int{
	arr := make([]int, len)
	for i:=0; i<len; i++{
		sc.Scan()
		tmp, err := strconv.Atoi(sc.Text())
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func scanStringLine(len int) []string{
	arr := make([]string, len)
	for i:=0; i<len; i++{
		sc.Scan()
		arr[i] = sc.Text()
	}
	return arr
}

func scanIntSplit(len int) []int{
	arr := make([]int, len)
	sc.Scan()
	for i, v := range strings.Split(sc.Text(), " "){
		tmp, err := strconv.Atoi(v)
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func main(){
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	var a, b, k int
	arr := make([]int, 0)
	fmt.Scan(&a, &b, &k)
	for i:=1; i<=100; i++ {
		if a%i == 0 && b%i == 0 {
			arr = append(arr, i)
		}
	}
	fmt.Println(arr[len(arr)-k])
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <set>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    double Hangle, Mangle, M2;
    static const double pi = 3.141592653589793;

    M2 = H*60 + M;
    Mangle = 6*M;
    Hangle = M2/2;

    double angle;
    if(Mangle >= Hangle){
        if(Mangle - Hangle <= 180){
            angle = Mangle - Hangle;
        }
        else{
            angle = 360 - Mangle + Hangle;
        }
    }
    else{
        if(Hangle - Mangle <= 180){
            angle = Hangle - Mangle;
        }
         else{
            angle = 360 - Hangle + Mangle;
        }
    }


    double rad = pi*angle/180;

    double ans;
    double A2 = A*A;
    double B2 = B*B;
    double Cos = cos(rad);



    if(angle == 180){
        cout << A + B << endl;
    }
    else if(angle == 0){
        cout << max(A, B) - min(A, B) << endl;
    }
    else{
        ans = A2 + B2 - 2*A*B*Cos;
        ans = pow(ans,0.5);
        cout << fixed << setprecision(20) << ans << endl;
    }

    
}

Measured memory_bytes: 4436
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

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

    int H, W;
    cin >> H >> W;
    vector<string> A(H);
    REP(i, H) cin >> A[i];
    bool ans = true;
    int w = 0;
    REP(i, H-1){
        while(A[i][w+1] == '#') w++;
        FOR(j, w+1, W){
            if(A[i][j] != '.'){
                ans = false;
                break;
            }
        }
        REP(j, w){
            if(A[i+1][j] == '#'){
                ans = false;
                break;
            }
        }
        if(A[i+1][w] != '#'){
            ans = false;
            break;
        }
    }
    puts(ans ? "Possible" : "Impossible");
    return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N,M;
string S;
ll dp [5001] [5001];
const ll MOD = 1e9 + 7;

long long pow_mod(long long x,long long y,long long i = MOD - 2)
{
	while(i){
		if(i & 1){
			(x *= y) %= MOD;
		}
		(y *= y) %= MOD;
		i >>= 1;
	}

	return x;
}

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

	cin >> N >> S;
	M = S.size();

	dp [0] [0] = 1;
	FOR(i,0,N) FOR(j,0,N) if(dp [i] [j]){
		if(j == 0){
			(dp [i + 1] [j] += dp [i] [j]) %= MOD;
			(dp [i + 1] [j + 1] += dp [i] [j] * 2) %= MOD;
		}
		else{
			(dp [i + 1] [j - 1] += dp [i] [j]) %= MOD;
			(dp [i + 1] [j + 1] += dp [i] [j] * 2) %= MOD;
		}
	}

	ll ans = pow_mod(dp [N] [M],pow_mod(1,2),M);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 116864
#include<cstdio>
#include<iostream>

#define INF 100000000000.0
using namespace std;

void swap(int *a,int *b){
	*a=*a+*b;
	*b=*a-*b;
	*a=*a-*b;
	return;
}

int main(void){

	int n,inp;
	int maxa[8],mina[8];
	int wa,zyo;

	cin>>n;

	for(int i=0;i<n;i++){
		cin>>inp;
		for(int j=0;j<8;j++){
			maxa[j]=inp%10;
			mina[j]=inp%10;
			inp/=10;
		}
		for(int j=0;j<8;j++){
			for(int k=0;k<8-j-1;k++){
				if(maxa[k]<maxa[k+1]) swap(&maxa[k],&maxa[k+1]);
				if(mina[k]>mina[k+1]) swap(&mina[k],&mina[k+1]);
			}
		}
		wa=0,zyo=1;
		for(int j=8-1;j>=0;j--){
			wa+=maxa[j]*zyo-mina[j]*zyo;
			zyo*=10;
		}
		cout<<wa<<endl;
	}


	return 0;
}

Measured memory_bytes: 1156
#include<cstdio>
using namespace std;

int main(){
	char a,b,c,d,A,B,C,D,check=0;
	scanf(" %c %c %c %c",&A,&B,&C,&D);
	a=(int)A-48;
	b=(int)B-48;
	c=(int)C-48;
	d=(int)D-48;
	if(a+b+c+d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d+%d+%d+%d=7\n",a,b,c,d);
	}
	if(a+b+c-d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d+%d+%d-%d=7\n",a,b,c,d);
	}
	if(a+b-c+d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d+%d-%d+%d=7\n",a,b,c,d);
	}
	if(a+b-c-d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d+%d-%d-%d=7\n",a,b,c,d);
	}
	if(a-b+c+d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d-%d+%d+%d=7\n",a,b,c,d);
	}
	if(a-b+c-d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d-%d+%d-%d=7\n",a,b,c,d);
	}
	if(a-b-c+d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d-%d-%d+%d=7\n",a,b,c,d);
	}
	if(a-b-c-d==7&&check!=1){
		if(a==b||a==c||a==d||b==c||b==d||c==d) check=1;
		printf("%d-%d-%d-%d=7\n",a,b,c,d);
	}
}
	

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

int main(){
  //小数点以下12ケタを表示させるためのおまじない
  cout<<fixed<<setprecision(12);


  while(1){
    int n;
    double s[1000];
    double sum=0;

    cin>>n;
    
    if(n==0){
      break;
    }
    
    for(int i=0;i<n;i++){
      cin>>s[i];
    }
  
    for(int i=0;i<n;i++){
      sum+=s[i];
    }
  
    double avg=sum/n;

    double ans=0;
  
    for(int i=0;i<n;i++){
      ans+=pow(s[i]-avg,2);
    }

    ans=sqrt( ans/n );
  
    cout<<ans<<endl;
  }
  return 0;  
}



Measured memory_bytes: 3284
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


a,b = map(int, input().split())
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
 
def lcm(a, b):
    return a//gcd(a, b)*b
print(lcm(a,b))

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

#define times(n, i)      uptil(0, n, i)
#define upto(f, t, i)    for(decltype(t) _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(decltype(t) _##i = (t), i = (f); i < _##i; i++)
#define downto(f, t, i)  for(decltype(t) _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(decltype(t) _##i = (t), i = (f); i > _##i; i--)
#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define all(v) v.begin(), v.end()
#define ln << "\n"

struct line{};

template<class T> istream& operator>>(istream& in, vector<T>& v) {
    times(v.capacity(), i) in >> v[i];
    return in;
}

template<class T> ostream& operator<<(ostream& out, const vector<T>& v) {
    times(v.size(), i) out << (i ? " " : "") << v[i];
    return out;
}

template<class T, class...U> typename enable_if<is_same<T, line>::value, string>::type next(istream& in, const U&... args) {
    string s;
    getline(in, s, args...);
    return move(s);
}

template<class T, class...U> typename enable_if<!is_same<T, line>::value, T>::type next(istream& in, const U&... args) {
    T t(args...);
    in >> t;
    return move(t);
}
template<class T, class...U> auto next(const U&... args) -> decltype(next<T>(cin)) {
    return next<T>(cin, args...);
}

template<class T> T sum(const vector<T>& v) {
    T ans = T();
    for(const T& t : v) ans += t;
    return ans;
}

template<class T> T sum(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    T ans = T();
    for(typename vector<T>::iterator t = begin; t != end; t++) ans += *t;
    return ans;
}

template<class T> T min(const vector<T>& v) {
    return *min_element(v.begin(), v.end());
}

template<class T> T min(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    return *min_element(begin, end);
}

template<class T> T max(const vector<T>& v) {
    return *max_element(v.begin(), v.end());
}

template<class T> T max(const typename vector<T>::iterator& begin, const typename vector<T>::iterator& end) {
    return *max_element(begin, end);
}

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

    int N = next<int>(), A = next<int>(), B = next<int>(), C = next<int>();
    auto D = next<vector<int>>(N);
    sort(all(D), greater<int>());

    int ans = 0, cal = C, cost = A;
    for(int d : D) {
        cal += d;
        cost += B;
        ans = max(ans, cal / cost);
    }
    cout << ans ln;

    return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

typedef int Type;
struct Fenwick{
    vector<Type> bit;
    Fenwick(int n){
        bit = vector<Type>(n + 1);
    }
    void update(int i, Type v){
        int n = bit.size();
        ++i;
        while(i <= n){
            bit[i] += v;
            i += i & -i;
        }
    }
    Type get(int i){
        Type res = 0;
        ++i;
        while(i > 0){
            res += bit[i];
            i -= i & -i;
        }
        return res;
    }
};

signed main(){
	int N, K;
	cin >> N >> K;
	vector<int> a(N), b(N + 1);
	for(int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	b[0] = 0;
	for(int i = 1; i <= N; ++i) {
		b[i] = b[i-1] + (i - 1) * K + a[i - 1] - i * K;
	}
	vector<int> c = b;
	sort(ALL(c));
	c.erase(unique(ALL(c)), c.end());
	reverse(ALL(c));
	map<int,int> mp;
	for(int i = 0; i < c.size(); ++i) {
		mp[c[i]] = i;
	}

	int sum = 0;
	Fenwick bit(c.size());
	bit.update(mp[b[N]], 1);
	for(int i = N - 1; i >= 0; --i) {
		int t = mp[b[i]];
		// cerr << "<" << b[i] << "," << t << "," << bit.get(t) << endl;
		sum += bit.get(t);
		bit.update(t, 1);
	}
	cout << sum << endl;

	exit(0);
}


Measured memory_bytes: 18944
N=int(input())
res=0
for i in range(N):
    n,k=map(int,input().split())
    while n%k!=0 and n//k>0:
        q=n//k
        r=n%k
        R=r%(q+1)
        if r>q+1:
            n=q*k+R
        else:
            n=q*k+r-(q+1)
    if n%k==0:
        res^=n//k

if res==0:
    print("Aoki")
else:
    print("Takahashi")


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

#define itos(x) to_string(x)
#define stoi(x) stoi(x)
#define ctoi(x) (x-'0')

#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)(x).size()

#define ll long long
#define ld long double
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ld pi = acos((ld)-1);
const ld e = exp(1);

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a; cin >> a;
  cout << a+a*a+a*a*a << "\n";
  return 0;
}


Measured memory_bytes: 3564
#include<stdio.h>
#include<string.h>
#define max(a,b) ((a)>(b) ? (a):(b))
int dp[1001][1001];
int lcs(char *s,char *t){
    int i,j,ls,lt;
 
    ls=strlen(s);
    lt=strlen(t);
    for(i=0;i<ls;i++){
    for(j=0;j<lt;j++){
        if(s[i]==t[j]) dp[i+1][j+1]=dp[i][j]+1;
        else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    }
    }
    return dp[ls][lt];
}
int main(void){
    char s[1001],t[1001];
    int k;
 
    scanf("%d",&k);
    while(k--){
    scanf("%s%s",s,t);
    printf("%d\n",lcs(s,t));
    }
 
    return 0;
}


Measured memory_bytes: 5688
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
    int n,l;
    cin>>n>>l;
    int ans = 1;
    int sum = 0;
    int val=INT_MAX;
    for(int i=1;i<=n;i++){
        if(abs(l+i-1)<val){
            ans=i;
            val=abs(l+i-1);
        }
        sum+=l+i-1;
    }
    cout<<sum-(l+ans-1);

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;

#define REP(i,a,b) for(i=a; i<b; ++i)
#define rep(i,n) REP(i,0,n)

int input[100][100];
int sum[100][100];
int lc[100];
char inbuf[500];

int main() {
  int i,j,k,cc = 0,cy;
  memset(input, 0, sizeof(input));
  memset(sum, 0, sizeof(sum));
  while(~scanf("%s", inbuf)) {
    cy = 0;
    char *tmp = strtok(inbuf, ",");
    input[cc][cy] = atoi(tmp);
    cy++;
    while((tmp = strtok(NULL, ",")) != NULL) {
      input[cc][cy] = atoi(tmp);
      cy++;
    }
    lc[cc] = cy;
    cc++;
  }

  sum[0][0] = input[0][0];
  rep(i,cc) {
    rep(j, lc[i]) {
      sum[i+1][j] = max(sum[i+1][j], sum[i][j]+input[i+1][j]);
      if(i < cc/2) {
	sum[i+1][j+1] = max(sum[i+1][j+1], sum[i][j]+input[i+1][j+1]);
      }else{
	sum[i+1][j-1] = max(sum[i+1][j-1], sum[i][j]+input[i+1][j-1]);
      }
    }
  }

  printf("%d\n",sum[cc-1][0]);
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
	double xA,yA,xB,yB,xC,yC,xD,yD;
	double dAi,dC;
	while(
		scanf(
				"%lf%lf%lf%lf%lf%lf%lf%lf",
				&xA,&yA,&xB,&yB,&xC,&yC,&xD,&yD
		) != EOF
	){
		if(yB == yA){
			puts(xD == xC ? "YES" : "NO");
		}else if(xD == xC){
			puts(yB == yA ? "YES" : "NO");
		}else{
			dAi = (xA - xB) / (yB - yA);
			dC = (yD - yC) / (xD - xC);
			puts(dAi == dC ? "YES" : "NO");
		}
	}

	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define EPS 1e-9
using namespace std;
const int N=1e5,OO=0x3f3f3f3f;
typedef  long long ll;
int main() {
  int a,b,k; cin>>k>>a>>b;
  for(int i=a;i<=b;i++)
      if(i%k==0)
          return cout<<"OK",0;
      cout<<"NG";
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d,n;
  cin>>d>>n;
  if(d==0){
    if(n<=99) cout<<n<<endl;
    else cout<<n+1<<endl;
  }
  else if(d==1){
    int c=0;
    int a;
    for(int i=100;;i+=100){
      if(i%10000!=0) c++;
      if(c==n){ a=i;break;}
    }
    cout<<a<<endl;
  }
  else if(d==2){
    int c=0;
    int a;
    for(int i=10000;;i+=10000){
      if(i%1000000!=0) c++;
      if(c==n) {a=i;break;}
    }
    cout<<a<<endl;
  }
}
    


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

int main() {
  string s, t;
  cin >> s >> t;
  t.pop_back();
  if (s == t) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[100],b[100],ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[i]=a[i];
  }
  sort(b,b+n);
  for(int i=0;i<n;i++){
    if(a[i]!=b[i])
      ans++;
  }
  if(ans==2 || ans==0)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
    
  return(0);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
struct S{int x1,x2,y1,y2;string s;}_;
int main()
{
	int n,m,b,h,w,i,j,x,y;
	string s;
	while(cin>>n>>w>>h)
	{
		map<string,vector<S> >M;
		vector<string> V;
		vector<string>::iterator ite;
		for(i=0;i<n;++i)
		{
			cin>>s>>b;
			if(!i)V.push_back(s);
			for(j=0;j<b;++j)cin>>_.x1>>_.y1>>_.x2>>_.y2>>_.s, M[s].push_back(_);
		}
		cin>>m;
		ite=V.begin();
		for(i=0;i<m;++i)
		{
			cin>>s;
			if(s=="click")
			{
				cin>>x>>y;for(j=0;j<M[*ite].size();++j)
				{
					_=M[*ite][j];
					if(x>=_.x1&&x<=_.x2&&y>=_.y1&&y<=_.y2)
					{	V.erase(ite+1,V.end());
						V.push_back(_.s);
						ite=V.end()-1;
						break;
					}
				}
			}
			if(s=="back") if(ite!=V.begin())--ite;
			if(s=="forward") if(ite!=V.end()-1)++ite;
			if(s=="show") cout<<*ite<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	ll A, B, V, W, T;
	cin >> A >> V >> B >> W >> T;

	if (A < B) {
		if (A + V * T < B + W * T) {
			cout << "NO" << endl;
		}
		else {
			cout << "YES" << endl;
		}
	}
	else {
		if (B - W * T < A - V * T) {
			cout << "NO" << endl;
		}
		else {
			cout << "YES" << endl;
		}
	}

EndPoint:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG

	return 0;
}




Measured memory_bytes: 3196
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
int MOD=1000000007;
int inf=1e18+7;
signed main(){
    int n,t;cin>>n>>t;
    vector<int> a(n);
    map<int,int> memo;
    int bmn=inf;int submx=0;
    rep(i,n){
        cin>>a[i];
        bmn=min(bmn,a[i]);
        submx=max(submx,a[i]-bmn);
    }
    int res=0;
    for(int i=n-1;i>=0;--i){
        memo[a[i]]=1;
        auto it=memo.find(a[i]+submx);
        if(it!=memo.end()){
            ++res;
        }
    }
    cout<<res<<"\n";
    return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define INF 10000000
using namespace std;
int gcd(int a, int b)
{
	if(a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
int main()
{
	int n, m;
	cin >> n >> m;
	int A[n + 1];
	queue<int> que;
	for(int i = 1; i <= n; i++)
	{
		cin >> A[i];
		que.push(i);
	}
	int ans = 0;
	int x = gcd(n, m);
	x = n / x;
	for(int i = 0; i < x; i++)
	{
		int a = INF, b = 0;
		for(int j = 0; j < m; j++)
		{
			int tmp = que.front();
			que.pop();
			if(A[tmp] < a)
				a = A[tmp];
			if(A[tmp] > b)
				b = A[tmp];
			que.push(tmp);
		}
		ans += b - a;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3156
#include "bits/stdc++.h"
using namespace std;
const int N = 26;
string s, t;
vector<int> a[N];
long long pv = -1, ans[N], req, idx[N], n;
int main() {
	cin >> s >> t;

	for (auto c : t)
		if (s.find(c) == string::npos)
			return 0 * printf("-1");

	for (int i = 0; i < s.size(); i++)
		a[s[i] - 'a'].push_back(i);

	n = s.size();
	for (auto c : t) {
		int i = c - 'a';

		auto j = upper_bound(a[i].begin(), a[i].end(), pv) - a[i].begin();
		idx[i] = j;

		if (idx[i] == a[i].size()) {
			req++;
			for (int i = 0; i < N; i++)
				idx[i] = 0;
		}

		ans[i] = 1ll * req * n + a[i][idx[i]];
		pv = a[i][idx[i]];
		idx[i]++;
	}

	cout << *max_element(ans, ans + N) + 1;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(i,arr)       for(int& i:arr)cin>>i;
#define output(i,arr)      for(int& i:arr)cout<<i<<" ";
#define for_each(arr)      for(auto& it:arr)
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //#endif
    cin>>s;
    if(s[0]!=s[1]||s[1]!=s[2])
    	cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    

    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 


Measured memory_bytes: 256
def solution():
    n, m = map(int, input().split())
    cs = [list(map(int, input().split())) for i in range(m)]
    if m == 0:
        if n > 1:
            print(10**(n-1))
        else:
            print("0")
        return
    ans = [-1 for i in range(n)]
    for w in cs:
        s, c = w[0], w[1]
        if (s == 1) and (c == 0) and (n > 1):
            print('-1')
            return
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != c:
            print('-1')
            return
    ansb = [str(i) if i != -1 else str(0) for i in ans]
    if (ansb[0] == '0') and (len(ansb) > 1):
        ansb[0] = '1'
    anss = ''
    for s in ansb:
        anss = anss + s
    print(anss)

solution()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>>h(200001);

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

    for(int i=0; i<h[n].size(); i++){
        int t = h[n][i];
        for(int j=0; j<h[t].size(); j++){
            if(h[t][j]==1){
                puts("POSSIBLE");
                return 0;
            }
        }
    }

    puts("IMPOSSIBLE");
    
    return 0;
}

Measured memory_bytes: 11308
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
#include <iomanip>
#include <fstream>
#include <array>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;

string s;

int main() {
	//freopen("test.in","r",stdin);
	cin >> s;
	int r = 0;
	if (s=="RRR") r = 3;
	else if (s=="SRR") r = 2;
	else if (s=="RRS") r = 2;
	else if (count(ALL(s),'R')) r = 1;
	cout << r <<endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

ll gcd(ll a, ll b){
    if (a < b) {
        ll tmp = a;
        a = b;
        b = tmp;
    }
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int N;
    cin >> N;
    ll tmp, ans;

    REP(i, N){
        cin >> tmp;
        if (i == 0) ans = tmp;
        else ans = gcd(ans, tmp);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

// N????´??????°????§£?????????<?´??????°, ?????´?????°>????????¢?????????
// N=12???????????? <2, 2>, <3, 1>?????????
map<long long, int> getFactorsMap(long long N){
    map<long long, int> ret;
    for (long long p=2; p*p <= N; p++) {
        while (N % p == 0) {
            N /= p;
            ret[p]++;
        }
    }
    if (N != 1) ret[N]++;
    return ret;
}

int main(void)
{
    int n;
    cin >> n;

    cout << n << ":";
    auto res = getFactorsMap(n);
    for(auto p : res) {
        REP(i, p.second) {
            cout << " " << p.first;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<stdio.h>

using namespace std;

int main()
{
  int r,c;
  int a[100][100];
  int s[100];
  for(int i=0;i<100;i++)
    s[i]=0;
 
  cin>>r>>c;
  for(int i=0;i<r;i++){
     int s_r=0;
    for(int j=0;j<c;j++){	  
      cin>>a[i][j];
      if(j)
	cout<<" ";
      cout<<a[i][j];
      s_r+=a[i][j];
      s[j]+=a[i][j];
    }
    cout<<" "<<s_r<<endl;
  }
   int sum;
  for(int i=0;i<c;i++){
    if(i)
	cout<<" ";
      cout<<s[i];
      sum+=s[i];
  }
  cout<<" "<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3144
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}




int main(){
  int N;
  cin>>N;
  int C[N-1],S[N-1],F[N-1];
  for(int i=0;i<N-1;i++){
    cin>>C[i]>>S[i]>>F[i];
  }
  for(int i=0;i<N-1;i++){
    int sum=0;
    for(int j=i;j<N-1;j++){
      if(sum<S[j]){
        sum=S[j]+C[j];


      }else if(sum%F[j]==0){
        sum+=C[j];

      }else{
        sum+=F[j]-(sum)%F[j]+C[j];
      }

    }
    cout<<sum<<endl;
  }
  cout<<0<<endl;
}



  

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
int digit(int n){
	int count=0;
	while(n!=0){
		count++;
		n=n/10;
	}
	return count;
}
  int main(){
  	int n;
  	cin>>n;
  	if(digit(n)==1){
  		cout<<n<<endl;
	  }
	  if(digit(n)==2){
	  	cout<<9<<endl;
	  }
	  if(digit(n)==3){
	  	cout<<9+n-99<<endl;
	  }
	  if(digit(n)==4){
	  	cout<<900+9<<endl;
	  }
	  if(digit(n)==5){
	  	cout<<9+900+n-9999<<endl;
	  }
	  if(n==100000){
	  	cout<<90909<<endl;
	  }
	
	return 0;
}


Measured memory_bytes: 256
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use permutohedron::LexicalPermutation as _;
use proconio::{fastout, input, marker::*};
//use std::collections::HashSet;
use std::collections::*;
//use std::collections::BTreeMap;
//use std::cmp::*;
//use std::num;
//use petgraph::unionfind::UnionFind;

#[fastout()]
fn main() {
    input! {
        N:usize, mut S:[String;N]
    }
    S.sort();
    //println!("{:?}", S);
    let emptystring = "".to_string();
    let mut m = HashMap::new();
    //let S: Vec<String> = S.iter().map(|s| s.iter().collect::<String>()).collect();
    let mut max = 0;
    for i in 0..N {
        *m.entry(S[i].clone()).or_insert(0) += 1;
        let k = *m.get(&S[i]).unwrap();
        max = std::cmp::max(max, k);
        if k != 1 {
            S[i] = emptystring.clone();
        }
    }
    for i in 0..N {
        //        let s = S[i];
        if S[i] != emptystring && *m.get(&S[i]).unwrap() == max {
            println!("{}", S[i]);
        }
    }
}


Measured memory_bytes: 31712
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    for(int i = 0; i < b; ++i){
        if((i * a) % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    t = point[0]
    x = point[1]
    y = point[2]
    distance = abs(x- x_before) + abs(y - y_bfefore)
    interval = t - t_before
    
    
    if t %2 == (x+y)%2 and interval >= distance:
        t_before=t
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 27380
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> P;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    int N, X, sum = 0, mini = 1000000007;
    cin >> N >> X;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        sum += a;
        mini = min(mini, a);
    }
    cout << (X - sum) / mini + N << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;

#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define ALL(obj) (obj).begin(),(obj).end()

#define rt return
#define ENDL cout<<endl
#define s second
#define f first

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int gcd(int a,int b){
    if(b == 0)return a;
    return gcd(b, a % b);
}
int main(){
    int N;cin >> N;
    LL ans = 0;
    for (int i = 0;i < N;i++) {
        int b;cin >> b;
        if(i == 0)ans = b;
        else ans = gcd(b,ans);
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int g[101][101],r[101],k[101];
  int i,j,n,m;
  
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      scanf("%d",&g[i][j]);
    }
  }

  for(j=0;j<m;j++){
    scanf("%d",&r[j]);
  }
  
  for(i=0;i<n;i++){
    k[i]=0;
    for(j=0;j<m;j++){
      k[i]+=g[i][j]*r[j];
    }
  }
  for(i=0;i<n;i++){
    printf("%d\n",k[i]);
  }
  
  return 0;
}



Measured memory_bytes: 2144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

	Scanner sca = new Scanner(System.in);
	long n = sca.nextLong();
	long a = sca.nextLong();  // blue
	long b = sca.nextLong();  // red
	long blue_times = n / (a+b);
	long blue_amari = n % (a+b);
	long ans = a * blue_times;


	if(blue_amari > a) {
		ans += a;
	}
	else {
		ans += blue_amari;
	}

	System.out.println(ans);


	// 後始末
	sca.close();
	}
}

Measured memory_bytes: 22608
#include <bits/stdc++.h>
 
using namespace std;
 
#define EPS 1e-9
#define M 256
#define INF 1e9
 
int main(){
    int N;
    while(cin >> N, N > 0){
	int I[N+1],R[N+1],O[N+1];
	for(int i = 0 ; i < N ; i++){
	    cin >> I[i];
	}
	int S,A,C;
	double ans = INF;
	for(int s = 0 ; s <= 15 ; s++){
	    for(int a = 0 ; a <= 15 ; a++){
		for(int c = 0 ; c <= 15 ; c++){
		    int x[M] = {0};
		    R[0] = s;
		    for(int i = 1 ; i <= N ;i++){
			R[i] = (a*R[i-1]+c) % M;
			O[i] = (I[i-1]+R[i]) % M;
			x[O[i]]++;
		    }
		    double H = 0;
		    for(int i = 0 ; i < M ; i++){
			double p = (double)x[i]/N;
			if(p > 0){
			    H -= p*log(p);
			}
		    }
		    if(H+EPS < ans){
			ans = H;
			S = s; A = a; C = c;
		    }
		}
	    }
	}
	cout << S << " " << A << " " << C << endl;
    }
    return 0;
}

Measured memory_bytes: 3364
import Control.Applicative
import Control.Monad
data Rect = Rect Double Double Double Double

-- x1 < x2
-- y1 < y2

main = do
    line <- lines<$>getContents
    mapM_ solve line

solve :: String -> IO ()
solve str = do
    let ps = map read.words $ str
        (a,b) = splitAt 4 ps
        (rectA,rectB) = (toRect a, toRect b)
    if isIntersect rectA rectB then putStrLn "YES" else putStrLn "NO"

isIntersect :: Rect -> Rect -> Bool
isIntersect (Rect xa1 ya1 xa2 ya2) (Rect xb1 yb1 xb2 yb2)
  | ya1 > yb2 || ya2 < yb1 = False
  | xa1 > xb2 || xa2 < xb1 = False
  | otherwise = True

toRect [a,b,c,d] = Rect a b c d

Measured memory_bytes: 4156
#include <bits/stdc++.h>
int ABS(int a){
	if(a<0) return -a;
	return a;
}
using namespace std;
int main()
{
	int a,b,c,d;
    scanf("%d %d %d %d", &a,&b,&c,&d);
	if(ABS((a-c))<=d || (ABS(a-b)<=d && ABS(c-b)<=d)) printf("Yes");
	else printf("No");
    return 0;
}

Measured memory_bytes: 256
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)

apples = p[:X] + q[:Y] + r
apples.sort(reverse=True)

value = sum(apples[:X+Y])
print(value)

Measured memory_bytes: 111852
#include <iostream>
using namespace std;
int main(void){
    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin >> n;
    cout << a[n - 1] << endl;
}


Measured memory_bytes: 256
a = int(input())
ar = list(map(int,input().split(" ")))
n = 1
count = 0
b = False
for i in range(a):
    if ar[i] == n:
        n += 1
        b = True
    else:
        count += 1
if b:
    print(count)
else:
    print(-1)

Measured memory_bytes: 24744
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000007;
const long double PI=3.14159265358979;
const ll MAX=0;

int main() {
  ll H,M,h,m,T;
  cin>>H>>M>>h>>m>>T;
  ll ans=h*60+m;
  ans-=H*60+M+T;
  cout<<ans;
}



Measured memory_bytes: 3640
from sys import stdin
from operator import attrgetter
readline = stdin.readline


def cosine_formula(a, b, c):
    return (b ** 2 + c ** 2 - a ** 2) / (2 * b * c)


def unit(a):
    return a / abs(a)

import math

def main():
    ax, ay, ar = map(int, readline().split())
    bx, by, br = map(int, readline().split())
    a, b = complex(ax, ay), complex(bx, by)

    ab = abs(b - a)
    ac = (ar ** 2 + ab ** 2 - br ** 2) / (2 * ab)
    c = a + (b - a) * (ac / ab) 
    pc = math.sqrt(ar ** 2 - ac ** 2)
    p, q = c + pc * unit(b - a) * 1j, c + pc * unit(b - a) * -1j
    
    if p.real > q.real:
        p, q = q, p
    if abs(p.real - q.real) < 1e-6 and p.imag > q.imag:
        p, q = q, p

    print('{:.10f} {:.10f} {:.10f} {:.10f}'.format(p.real, p.imag, q.real, q.imag))
main()

Measured memory_bytes: 6864
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int dx[4]={1,-1,0,0};
const int dy[4]={0,0,1,-1};
const char dir[4]={'R','L','U','D'};
const int N=1005;
int d[N],x[N],y[N],k,n,cnt;
ll mn,now,X,Y;

int main(){
	read(n);
	rep(i,1,n){
		read(x[i]),read(y[i]);
		if(((x[i]^y[i])&1)^((x[1]^y[1])&1))
			return puts("-1"),0;
	}
	per(i,30,0)d[++cnt]=1<<i;
	if(((x[1]^y[1])&1)==0)d[++cnt]=1;
	printf("%d\n",cnt);
	rep(i,1,cnt)printf("%d ",d[i]);
	puts("");
	rep(i,1,n){
		X=Y=0;
		rep(j,1,cnt){
			int o=-1; mn=1e18;
			rep(k,0,3){
				now=abs(X+dx[k]*d[j]-x[i])+abs(Y+dy[k]*d[j]-y[i]);
				if(now<mn) mn=now,o=k;
			}
			X+=dx[o]*d[j],Y+=dy[o]*d[j];
			putchar(dir[o]);
		}
		puts("");
		assert(X==x[i]&&Y==y[i]);
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define all(x) x.begin(),x.end()
#define ln '\n'
const long long MOD = 1000000007LL;
//const long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    cout << N*(N+1)/2 << ln;
}


Measured memory_bytes: 256