akhauriyash/Code-Regression huggingface dataset:
package main                                

import "fmt"

func main() {
  var a int
  fmt.Scan(&a)

  var b int
  fmt.Scan(&b)

  var c int
  fmt.Scan(&c)

  var x int
  fmt.Scan(&x)

  var ans int = 0
  for i := 0; i <= a; i++{
    for j := 0; j <= b; j++{
      for k := 0; k <= c; k++{
        if 500 * i + 100 * j + 50 * k == x {
          ans++
        }
      }
    }
  }

  fmt.Printf("%d\n", ans)

}


Measured memory_bytes: 512
/*
  
  Author: Arnab Sinha
	
  ███████╗██╗  ██╗███████╗██████╗         ██╗      ██████╗  ██████╗██╗  ██╗███████╗██████╗  █████╗  █████╗ 
  ██╔════╝██║  ██║██╔════╝██╔══██╗        ██║     ██╔═══██╗██╔════╝██║ ██╔╝██╔════╝██╔══██╗██╔══██╗██╔══██╗
  ███████╗███████║█████╗  ██████╔╝        ██║     ██║   ██║██║     █████╔╝ █████╗  ██║  ██║╚██████║╚██████║
  ╚════ █║██╔══██║██╔══╝  ██╔══██╗        ██║     ██║   ██║██║     ██╔═██╗ ██╔══╝  ██║  ██║ ╚═══██║ ╚═══██║
  ███████║██║  ██║███████╗██║  ██║███████╗███████╗╚██████╔╝╚██████╗██║  ██╗███████╗██████╔╝ █████╔╝ █████╔╝
  ╚══════╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚══════╝╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝╚══════╝╚═════╝  ╚════╝  ╚════╝                                                                                                        
*/
 
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define li long long int
#define ld long long double
#define all(v) v.begin(),v.end()
#define sort(a) sort(all(a))
#define rev(a) reverse(all(a))
#define pb push_back
#define INF 1e18+10
#define MINF -1e18-10
#define rep(i,a,b) for(li i=a;i<b;i++)
#define vli vector<li>
#define MAXN 1e5+10
using namespace std;
 
li power(li a, li b, li mod) { a%=mod; li ret = 1; while(b){ if(b&1) ret*=a; a*=a;; if(ret>=mod) ret%=mod; if(a>=mod) a%=mod; b>>=1; } return ret; }
 
template <class T> void read(T& x){
	cin>>x;
}
 
template <class T, class... U> void read(T& x, U&... u){
	read(x);
	read(u...);
}
 
template <class A> void read(vector<A>& v){
	for(auto &it:v)
		read(it);
}
 
template <class A> void print(A x){
	cout<<x;
}
 
template <class A> void printl(A x){
	cout<<x<<endl;
}
 
template <class A> void print(vector<A>& v)
{
	for(auto &it:v){
		print(it);
		cout<<' ';
	}
	cout<<'\n';
}
 
void solve()
{
	string str;
	cin>>str;

	if(str[str.size()-1]=='s'){
		cout<<str<<"es"<<endl;
	}
	else{
		cout<<str<<'s'<<endl;
	}
}

 
int main()
{
	IOS;
 	
 	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

 	solve();
 
	return 0;
}

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

std :: vector < std :: pair < int, bool > > swords ;

int main ( )  {
	int n, h ;

	scanf ( "%d%d", & n, & h ) ;

	for ( int i = 1 ; i <= n ; ++ i )  {
		int a, b ;
		scanf ( "%d%d", & a, & b ) ;
		swords.push_back ( std :: make_pair ( a, 0 ) ) ;
		swords.push_back ( std :: make_pair ( b, 1 ) ) ;
	}

	std :: sort ( swords.begin ( ), swords.end ( ) ) ;

	int ans ( 0 ) ;

	for ( std :: vector < std :: pair < int, bool > > :: reverse_iterator it = swords.rbegin ( ) ; it != swords.rend ( ) ; ++ it )  {
		if ( it -> second )  ++ ans, h -= it -> first ;
		else {
			if ( h / it -> first )  {
				ans += h / it -> first + ( h % it -> first != 0 ) ;
				h %= it -> first, h -= ( h % it -> first != 0 ) * it -> first ;
			}
		}
		if ( h <= 0 )  break ;
	}
	
	return ! printf ( "%d\n", ans ) ;
}


Measured memory_bytes: 2420
N, K = map(int, input().split())
k = list()
nlist = set()

for i in range(K):
    d = input()
    temp_ = list(map(int, input().split()))
    for i in range(len(temp_)):
        nlist.add(temp_[i])
N_ = len(nlist)
print(N - N_)

Measured memory_bytes: 9188
N = int(input())
s = input().strip()
t = input().strip()

l = N  # 答えの候補
while True:
    # s,tの長さNなので，重複の長さは2N-l
    k = 2*N-l
    if k <= 0 or s[-k:] == t[:k]: break
    l += 1
print(l)


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

int sq(int n){
  for(int i=1;;i++){
    if(i*i>=n){
      return i;
      break;
    }
  }
}
int pr(int n){
  int count=0;
  for(int i=2;i<=sq(n);i++){
    if(n%i==0){
      count++;
    }
  }
  if((count==0&&n!=1)||n==2){
    return 1;
  }
  else{
    return 0;
  }
}

int main(){
  int n;
  cin >> n;
  int a[n],b[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  int x[50000],y[50000];
  for(int i=1;i<100000;i+=4){
    if(pr(i)==1&&pr((i+1)/2)==1){
      x[(i-1)/2]=1;
    }
    else{
      x[(i-1)/2]=0;
    }
  }
  x[1]=1;
  for(int i=3;i<100000;i+=2){
    x[i]=0;
  }
  for(int i=0;i<50000;i++){
    y[i]=0;
  }
  for(int i=0;i<50000;i++){
    for(int j=0;j<=i;j++){
      y[i]+=x[j];
    }
  }
  for(int i=0;i<n;i++){
    cout << y[(b[i]-1)/2]-y[(a[i]-1)/2-1] << endl;
  }
}

Measured memory_bytes: 1792
h,w = map(int, input().split())
a = [input() for i in range(h)]
row = [0]*h
col = [0]*w
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            row[i] = 1
            col[j] = 1

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end = '')
        print()


Measured memory_bytes: 4468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
vector<ll> fac, finv, inv;


int main(){
    int h, w;  cin >> h >> w;
    vector<vector<int>> g(h, vector<int>(w));
    
    REP(i, h) REP(j, w) cin >> g[i][j];
    vector<pair<ll, ll>> bef, aft;

    
    REP(i, h){
        REP(j, w-1){
            if(g[i][j]&1){
                g[i][j] -= 1;
                g[i][j+1] += 1;
                bef.push_back({i, j});
                aft.push_back({i, j+1});
            }
        }
    }

    REP(i, h-1){
        if(g[i].back()&1){
            g[i].back() -= 1;
            g[i+1].back() += 1;
            bef.push_back({i, w-1});
            aft.push_back({i+1, w-1});
        }
    }

    cout << aft.size() << endl;
    REP(i, aft.size())
        cout << bef[i].first+1  << ' ' << bef[i].second+1 << ' ' <<
        aft[i].first+1  << ' ' << aft[i].second+1 <<  endl;

    

}

Measured memory_bytes: 7268
#include <iostream>
#include <string.h>
#include<algorithm>
using namespace std;

int main()
{
	int N,flag=0;
	cin >>N;
	for (int i = 1; i < 10; i++) {
		if (N % i == 0 && N / i < 10)flag++;
	}
	if (flag > 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

int main() {
  int n; cin >> n;
  vector<int> arr(n);
  for (auto &a : arr) cin >> a;
  for (int i=0; ; ++i) {
    for (auto &a : arr) {
      if (a%2) {
        cout << i << endl;
        return 0;
      } else {
        a /= 2;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int n,m;
vector<int>v[200001];
bool vis[200001];
int d[200001];
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    cin>>n>>m;
    int x,y;
    for(int i=0;i<m;i++){
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }

    queue<int>q;
    q.push(1);
    d[1]=0;
    while(!q.empty()){
        int p=q.front();
        q.pop();
        vis[p]=true;
        for(int i=0;i<v[p].size();i++){
                if(p==1&&v[p][i]==n)continue;
            if(!vis[v[p][i]]){
                d[v[p][i]]=d[p]+1;
                q.push(v[p][i]);
            }
        }
    }
    if(d[n]==2)cout<<"POSSIBLE";
    else cout<<"IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 13424
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

int32_t main()
{
	//freopen("input.txt", "r", stdin);
	IOS;
	
	string s; cin >> s;
	if(s.back() == 's')
	{
		cout << s + "es" << '\n';
	}
	else
	{
		cout << s + "s" << '\n';
	}
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
ll H[MAX_N];

void solve() {
	cin >> N >> K;
	rep(i, 0, N) cin >> H[i];
	sort(H, H + N);
	ll sum = 0;
	rep(i, 0, N - K) sum += H[i];
	cout << sum << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
#define MN 105
using namespace std;
inline ll in(){
    ll x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
struct vec{
	ll x,y;
	int id;
}a[MN];
struct lin{
	ll a,b,c;
}d[MN];
int q[MN<<1],n,tot;
bool vis[MN];
double res[MN];
ll c,g;
inline vec operator +(vec a,vec b){
	return (vec) {a.x+b.x,a.y+b.y};
}
inline vec operator -(vec a,vec b){
	return (vec) {a.x-b.x,a.y-b.y};
}
inline vec operator *(vec a,ll b){
	return (vec){a.x*b,a.y*b}; 
}
inline vec operator /(vec a,ll b){
	return (vec){a.x/b,a.y/b};
}
inline ll operator ^(vec a,vec b){
	return a.x*b.y-a.y*b.x;
}
inline bool cmp(vec a,vec b){
	return (a.x==b.x)?a.y<b.y:a.x<b.x;
}
inline ll gcd(ll x,ll y){
	return y?gcd(y,x%y):x; 
}
int main()
{
	n=in();if (n==1) {printf("1");return 0;}
	for (int i=0;i<n;++i){
		a[i].x=(in()<<1ll);a[i].y=(in()<<1ll);a[i].id=i;
	}sort(a,a+n,cmp);
	int hd=1,tl=0;
	for (int i=0;i<n;++i){
		while (tl>1&&((a[q[tl]]-a[q[tl-1]])^(a[i]-a[q[tl]]))<=0) --tl;
		q[++tl]=i;	
	}tot=tl;
	for (int i=n-2;i>=0;--i){
		while (tl>tot&&((a[q[tl]]-a[q[tl-1]])^(a[i]-a[q[tl]]))<=0) --tl;
		q[++tl]=i;
	}--tl;
	for (int i=1;i<=tl;++i) q[i-1]=q[i];q[tl]=0;
	for (int i=1;i<=tl;++i) vis[a[q[i]].id]=1;
	for (int i=1;i<=tl;++i){
		vec P=a[q[i%tl]],Q=a[q[i-1]];
		vec mid=((P+Q)/(2ll)),dif=((P-Q));
		g=gcd(abs(dif.x),abs(dif.y));dif.x/=g;dif.y/=g;
		if (d[i%tl].a*d[i%tl].b>0) d[i%tl].a=dif.x,d[i%tl].b=-dif.y;
		else d[i%tl].a=-dif.x;d[i%tl].b=dif.y;
	}
	for (int i=0;i<tl;++i){
		double aa=atan2(d[i].a,d[i].b),ab=atan2(d[(i+1)%tl].a,d[(i+1)%tl].b);
		if (aa<0) aa+=(2.0*acos(-1));if (ab<0) ab+=(2.0*acos(-1));
		res[a[q[i]].id]=ab-aa;if (res[a[q[i]].id]<=0) res[a[q[i]].id]+=2.0*acos(-1);   
	}
	for (int i=0;i<n;++i) if (!vis[i]) printf("%.10lf\n",0.0);
	else printf("%.10lf\n",res[i]/(2.0*acos(-1)));
	return 0;
}

Measured memory_bytes: 128
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    print("YNeos"[ST()[:4]!="YAKI"::2])
if __name__ == '__main__':
    main()

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

using ll = long long;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}

// 約数列挙
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }

  sort(begin(ret), end(ret));
  return (ret);
}

// 素数判定
bool IsPrime(ll num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

  double sqrtNum = sqrt(num);
  for (int i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) {
        // 素数ではない
        return false;
    }
  }

  // 素数である
  return true;
}

// 最大公約数
ll gcd(ll a, ll b) {
   if (a%b == 0) {
       return(b);
   } else {
       return(gcd(b, a%b));
   }
}

int main() {
  ll A, B; cin >> A >> B;

  ll gcd_num = gcd(A, B);
  vector<ll> div = divisor(gcd_num);

  ll cnt = 1;
  REP(i, div.size()) {
    // cout << div.at(i) << endl;
    if(IsPrime(div.at(i))) {
      cnt++;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 384
#include<cstdio>
int main(){
    int n,a,prod3=1,prod2=1;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a);
        prod3*=3;
        if(a%2==0)prod2*=2;
    }
    printf("%d",prod3-prod2);
    return 0;
}

Measured memory_bytes: 128
# 累積和次は倒す
N = int(input())
S = input()
ans = 10 ** 9
white = [0] * (N + 1)
black = [0] * (N + 1)

for i, c in enumerate(S):
    if c == ".":
        white[i + 1] = white[i] + 1
        black[i + 1] = black[i]
    else:
        white[i + 1] = white[i]
        black[i + 1] = black[i] + 1
# 累積和
ans = min(ans, black[N], white[N])

white_sum = white[N]

for i in range(1, N):
    a = white_sum - white[i]
    b = black[i]
    # a 境目より右領域にどれだけ白があるか，その白は黒に変更
    # b 境目より左領域にどれだけ黒があるか，その黒は白に変更
    cnt = a + b
    ans = min(ans, cnt)
print(ans)

Measured memory_bytes: 12808
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;

    vector<vector<int> > a(h, vector<int>(w));
    vector<vector<int> > b(h, vector<int>(w, 0));
    vector<bool> y(h, false), x(w, false);
    for(int i=0; i<h; ++i){
        for(int j=0; j<w; ++j){
            cin >> a[i][j];
            if(!a[i][j]){
                b[i][j] = 1;
                y[i] = !y[i];
                x[j] = !x[j];
            }
        }
    }

    for(int i=0; i<h; ++i){
        for(int j=0; j<w; ++j){
            b[i][j] ^= (y[i] ^ x[j])? 1:0;
        }
    }

    for(int i=0; i<h; ++i){
        for(int j=0; j<w-1; ++j)
            cout << b[i][j] << ' ';
        cout << b[i][w-1] << endl;
    }
}

Measured memory_bytes: 8924
#include <stdio.h>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, n, m, x, y, z, ans = 0, na, nb, ra, rb;
  scanf("%lld%lld", &n, &m);
  ll uf[n];
  bool flg[n];
  for(i = 0; i < n; ++i) uf[i] = i, flg[i] = false;
  for(i = 0; i < m; ++i) {
    scanf("%lld%lld%lld", &x, &y, &z);
    na = --x, nb = --y, ra = rb = 0;
    while(uf[na] != na) na = uf[na], ra++;
    while(uf[nb] != nb) nb = uf[nb], rb++;
    uf[x] = na, uf[y] = nb;
    if(ra < rb) uf[x] = nb, uf[na] = nb;
    else uf[y] = na, uf[nb] = na;
  }
  for(i = 0; i < n; ++i) {
    na = i;
    while(uf[na] != na) na = uf[na];
    uf[i] = na;
    flg[na] = true;
  }
  for(i = 0; i < n; ++i) ans += flg[i];
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 1024
// incompleted
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX=1e5 + 10,MOD=1e9 + 7;
int N,K,A[105],mn=1e9;
int dp[MAX][2];
int f(int rem,int turn)
{
    //cout<<rem<<" "<<turn<<endl;
    if(rem<mn&&turn==1)return 0;
    if(rem<mn&&turn==0)return 1;
    if(dp[rem][turn]!=-1)return dp[rem][turn];
    for(int i=0;i<N;i++)
    {
        if(rem-A[i]>=0)
        if(f(rem-A[i],turn^1)==turn){
            return dp[rem][turn] = turn;
        }
    }
    return dp[rem][turn] = turn^1;
}
int main ()
{
    mn = 1e9 ;
    memset(dp,-1,sizeof dp);
    cin >> N >> K;
    for(int i=0;i<N;i++){cin>>A[i];mn = min(mn,A[i]);}
    if(f(K,0)==0){
        cout<<"First\n";
    }
    else cout<<"Second\n";
    //main();
    return 0;
}


Measured memory_bytes: 8832
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String T = sc.next();
      int min = 1000;
      int count;
      for(int i=0;i<S.length()-T.length()+1;i++){
        count = 0;
        for(int j=0;j<T.length();j++){
            if(S.charAt(j+i)!=T.charAt(j)){
              count++;
            }
        }
        min = Math.min(min,count);
      }
      if(S.equals(T)){
        min=0;
      }
      System.out.println(min);
    }
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()

string S, T, U;
int A, B;

int main() {
    cin >> S >> T >> A >> B >> U;
    if (S == U) A--;
    else B--;
    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
//*****************************believer******************************//
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef vector<pi> vpi;
typedef map<ll,ll> mi;
 
#define f first
#define ss second
#define ins insert
#define pb push_back
#define lb lower_bound 
#define ub upper_bound 
#define pq priority_queue
#define sqr(n) floor(sqrt(n))
#define sz(v) ((ll)(v.size()))
#define trav(a,x) for (auto& a: x)
#define all(v) (v).begin(),(v).end()
#define arl(v) (v).rbegin(),(v).rend()
#define mem(a) memset(a, -1, sizeof (a))
#define ssort(v) sort((v).begin(),(v).end())
#define rsort(v) sort((v).rbegin(),(v).rend())
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define vmn(a) (*min_element(a.begin(),a.end()))
#define vmx(a) (*max_element(a.begin(),a.end()))
#define foo(i,a,b) for (ll i = (a); i < (b); ++i)
#define foor(i,a,b) for (ll i = (a); i >= (b); --i)

const ll N=2e5+100;

const ll mm=1e9+7;

ll h,w;
string s[1001];
ll dp[1002][1002];


ll solve(ll x,ll y)
{
    if(x==0&&y==0)
    return 1;
    
    if(dp[x][y]!=-1)
    return dp[x][y];
    
    ll ans1=0;
    
    if(x>0&&s[x-1][y]!='#')
    ans1+=(solve(x-1,y))%mm;
    
    if(y>0&&s[x][y-1]!='#')
    ans1+=(solve(x,y-1))%mm;
    
    return dp[x][y]=(ans1%mm);
    
}

int main()
{
    cin>>h>>w;
    foo(i,0,h)
    cin>>s[i];
    
    mem(dp);
    ll ans=solve(h-1,w-1);
    cout<<ans<<"\n";
    return 0;
}



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

int n, m;
char arr1[110], arr2[110];

int main(){
	int i, j, now, flag = 0;
	scanf("%s %s", arr1, arr2);
	n = strlen(arr1); m = strlen(arr2);
	for(i = 0; i < n; i++){
		now = 0;
		for(j = 0; j < n; j++){
			if(arr1[j] == arr2[(i + j) % n]) now++;
		}
		if(now == n) flag = 1;
	}
	if(n == m && flag) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 256
// Date: 2020-03-28

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

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;
#define IO freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout)
#define FIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define D(x) cout << #x << " = " << x << endl;
#define SZ(x) ((int)x.size())
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
template <typename T> void chkmax(T &x, T y) { x = max(x, y); }
template <typename T> void chkmin(T &x, T y) { x = min(x, y); }
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int main() {
    FIO;
    int x; cin >> x;
    int ans = 0;
    ans += x / 500 * 1000;
    x %= 500;
    ans += x / 5 * 5;
    cout << ans;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        // a=1番大きい数 b=２番目に大きい数 c=３番目に大きい数
        int a,b,c;
        int count=0;
        int[] str = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();

        Array.Sort(str);
        a = str[2];
        b = str[1];
        c = str[0];

        while (b < a)
        {
            b++;
            c++;
            count++;
        }

        while (c < a)
        {
            c += 2;
            count++;

            if (a == b && b == c)
            {
                break;
            }

            if (a < c && b < c)
            {
                a++;
                b++;
                count++;
            }
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13396
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#include <typeinfo>

#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;


#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define sz size()

const double EPS = 1e-10;



double len(double xa,double ya,double xb,double yb){
    return sqrt( (xa-xb)*(xa-xb) + (ya-yb)*(ya-yb) );
}

double solve(double xa,double ya,double xb,double yb,double xc,double yc){
    double a,b,c;
    a=len(xa,ya,xb,yb);
    b=len(xa,ya,xc,yc);
    c=len(xb,yb,xc,yc);
//    cout<<"xb="<<xb<<"yb="<<yb<<"xc="<<xc<<"yc="<<yc<<endl;
    
    double z=(a+b+c)/2.0;
    
//    cout<<a<<" "<<b<<" "<<c<<" "<<z<<endl;
    
    double ret=z*(z-a)*(z-b)*(z-c);
//    cout<<ret<<endl;
    return sqrt(ret);
}


int main(){
    double x[30],y[30];
    double ans=0;
    double centerx=0,centery=0;
    int count=0;

    for(int i=0;;i++){
        char ch;

        if( !( cin>>x[i] && cin>>ch && cin>>y[i]) )break;
        
        count++;
        centerx+=x[i];
        centery+=y[i];
    }
    
    centerx/=count;
    centery/=count;

    rep(i,count){
//        cout<<x[i%count]<<"--"<<y[i%count]<<endl;
        ans+=solve(centerx,centery,x[i],y[i],x[(i+1)%count],y[(i+1)%count]);
//        cout<<"solve"<<i<<"="<<ans<<endl;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 1284
#include<bits/stdc++.h>
using namespace std;
int main() {
    int A,B; cin>>A>>B;
    int a,b,c,ans;
    a=A+B;
    b=A-B;
    c=A*B;
    ans=max({a,b,c});
    cout<<ans;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  int a = s.at(0) - '0';
  int b = s.at(1) - '0';
  int c = s.at(2) - '0';
  int d = s.at(3) - '0';

  if(a + b + c + d == 7){
    cout << a << "+" << b << "+" << c << "+" << d << "=" << 7 << endl;
    return 0;
  }else if(a - b + c + d == 7){
    cout << a << "-" << b << "+" << c << "+" << d << "=" << 7 << endl;
    return 0;
  }else if(a + b - c + d == 7){
    cout << a << "+" << b << "-" << c << "+" << d << "=" << 7 << endl;
    return 0;
  }else if(a - b - c + d == 7){
    cout << a << "-" << b << "-" << c << "+" << d << "=" << 7 << endl;
    return 0;
  }else if(a + b + c - d == 7){
    cout << a << "+" << b << "+" << c << "-" << d << "=" << 7 << endl;
    return 0;
  }else if(a - b + c - d == 7){
    cout << a << "-" << b << "+" << c << "-" << d << "=" << 7 << endl;
    return 0;
  }else if(a + b - c - d == 7){
    cout << a << "+" << b << "-" << c << "-" << d << "=" << 7 << endl;
    return 0;
  }else if(a - b - c - d == 7){
    cout << a << "-" << b << "-" << c << "-" << d << "=" << 7 << endl;
    return 0;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
//auto mod int

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){} //初期化指定子
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator++() {
      if ((x++) >= mod) x-= mod;
      return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator--() {
      if ((x += mod-1) >= mod) x-= mod;
      return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<int,int> mp,mp2;
    rep(i,n) mp[a[i]]++;
    mp2[2000] = mp[2000];
    for(int i=1999; i>=1; i--) mp2[i] = mp2[i+1] + mp[i]; //mp2:i以上の値の個数
    mint ans = 0;
    rep(i,n) {
        mint now = (k-1)*k/2;
        now *= mp2[a[i]+1];
        ans += now;
    }
    map<int,int> mp3;
    rep(i,n){
        int now = a[i];
        for(int j=now+1;j<=2000;j++){
            ans += mp3[j]*k;
        }
        mp3[now]++;
    }
    
    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 512
$<.readlines.drop(1).each do |l|
  x1, y1, x2, y2, x3, y3 = l.split.map(&:to_f)
  a = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)
  b1 = x1 * x1 + y1 * y1
  b2 = x2 * x2 + y2 * y2
  b3 = x3 * x3 + y3 * y3
  x = (b1 * (y2 - y3) + b2 * (y3 - y1) + b3 * (y1 - y2)) / (2 * a)
  y = (b1 * (x3 - x2) + b2 * (x1 - x3) + b3 * (x2 - x1)) / (2 * a)
  r = Math.sqrt((x - x1) ** 2 + (y - y1) ** 2)
  printf("%.3f %.3f %.3f\n", x, y, r)
end


Measured memory_bytes: 6916
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define REPR(i,n) for(int i=n-1; i>=(int)(0); i--)
#define FOR(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define FORR(i,a,b) for(int i=(int)(b)-1; i>=(int)(a); i--)
#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()
//**関数リスト**//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.second < secondElof.second;
}
ll nod(ll F) {
	ll keta = 1;
	while (F / 10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % 1 == 0) {
				return 0;
			}
		}
		return 1;
	}
}
void eratos(vl isPrime) {
	//(注)isPrimeのサイズはN+1にする！実際にはmain内に配置して使用
	ll i, j;
	REP(i, isPrime.size()) {
		isPrime[i] = 1;
	}
	isPrime[0] = 0; isPrime[1] = 0;
	for (i = 2; i * i <= isPrime.size() - 1; i++) {
		if (isPrime[i] == 1) {
			j = i * 2;
			while (j <= isPrime.size() - 1) {
				isPrime[j] = 0;
				j = j + i;
			}
		}
	}
}
ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
void bitSearch(ll n) {
	//実際にはコピーして中身を改変して使う
	ll i;
	REP(i, pow(2, n)) {
		ll p = i;
		REP(i, n) {
			cout << p % 2;
			p /= 2;
		}
		cout << endl;
	}
}

void bfs(ll now) {
	//中身は毎回書き換えて使用
	queue<ll> Q;
	Q.push(now);
	ll u;
	while (!Q.empty()) {
		u = Q.front();
		Q.pop();
		//ll v=;
		//Q.push(v);
	}
}
//**定義場所**//
ll i, j, k, l, m, n;
ll N, M, K, H, W;
ll MOD = 1000000007;
ll ans = 0;
//***********//

int main() {
	ll A, B;
	cin >> A >> B;
	if (abs(B - A) % 2 == 0) {
		cout << (A + B) / 2;
	}
	else {
		cout << "IMPOSSIBLE";
	}
}

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

int main() {
  int h,w,n,m,c,x,y,z,q,kazu;
  cin >> n>>m;
  
  vector<int> load(n+1);
	for(int i=0; i<m; i++){
		int a, b;
		cin >> a >> b;
		load.at(a)++;
		load.at(b)++;	
	}
 
	for(int i=1;i<n+1; i++)
    {cout << load.at(i) << endl;}
}


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

int main(int argc, char const *argv[])
{
	string s; cin >> s;
	int n; cin >> n;
	string ret;
	rep(i, s.size()) {
		if (i % n == 0) ret += s[i];
	}
	cout << ret << endl;
	return 0;
}



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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;
int n,m,x;
ll ans[15];
void inite(){
	for(int i=0; i<m+1; i++){
		ans[i] =0;
	}
}



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

	cin>>n>>m>>x;

	vector<int> Books[n+1];

	inite();



	for(int i=0; i<n; i++){
		for(int j=0; j<m+1; j++ ){
			int tmp;cin>>tmp;

			Books[i].push_back(tmp);
		}
	}



	ll ac =100000000000000;

	ll cnt=0;

	for(int bit =0; bit < (1<<n); ++bit){

		ll sum =0;
		inite();
/*
		writeln(bit);*/
		for(int j=0; j<n; j++){



			if(bit & (1<<j)){



				sum +=Books[j][0];

				for(int i=1; i<m+1; i++){
					ans[i] += Books[j][i];
				}
			}

		}


		bool judge =true;;
		for(int i=1; i<m+1; i++){
			if(x > ans[i])judge =false;
		}
		if(judge){
			if(sum !=0){
		/*		writeln(sum);*/
				cnt++;
			ac = min(ac,sum);
			}
		}
	}
	if(cnt){
	writeln(ac);
	}else {
		writeln(-1);
	}
}


Measured memory_bytes: 3656
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,g = map(int,readline().split())
XY = []
for i in range(n):
    XY.append(list(map(int,readline().split())))
ans = 10**32

if g == 2:
    for i in range(n):
        for j in range(i+1,n):
            hidarisita = (min(XY[i][0],XY[j][0]),min(XY[i][1],XY[j][1]))
            migiue = (max(XY[i][0],XY[j][0]),max(XY[i][1],XY[j][1]))
            ans = min(ans,abs((migiue[0]-hidarisita[0])*(migiue[1]-hidarisita[1])))

elif g == 3:
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                hidarisita = (min(XY[i][0],XY[j][0],XY[k][0]),
                min(XY[i][1],XY[j][1],XY[k][1]))
                migiue = (max(XY[i][0],XY[j][0],XY[k][0]),
                max(XY[i][1],XY[j][1],XY[k][1]))
                ans = min(ans,abs((migiue[0]-hidarisita[0])*(migiue[1]-hidarisita[1])))
else:

    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                for l in range(k+1,n):
                    hidarisita = (min(XY[i][0],XY[j][0],XY[k][0],XY[l][0]),
                    min(XY[i][1],XY[j][1],XY[k][1],XY[l][1]))
                    migiue = (max(XY[i][0],XY[j][0],XY[k][0],XY[l][0]),
                    max(XY[i][1],XY[j][1],XY[k][1],XY[l][1]))

                    res = 0
                    for m in range(n):
                        if hidarisita[0] <= XY[m][0] <= migiue[0] and \
                            hidarisita[1] <= XY[m][1] <= migiue[1]:
                            res += 1

                    if res >= g:
                        ans = min(ans,abs((migiue[0]-hidarisita[0])*(migiue[1]-hidarisita[1])))

print(ans)

Measured memory_bytes: 108224
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main()
{
    Hello
    ll l, r, mn = 1e18;
    cin >> l >> r;
    for(ll i = l; i <= min(l + 2019, r); i++)
        for(ll j = i + 1; j <= min(l + 2019, r); j++)
            mn = min(mn, (i * j) % 2019);
    cout << mn;
    return 0;
}


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

int main() {
	ll n;
	cin >> n;
	vector<vector<ll>> v(26, vector<ll>(n, 0));
	for (ll i = 0; i < n; ++i) {
		string s;
		cin >> s;
		for (char c : s) {
			++v[c - 'a'][i];
		}
	}
	for (ll i = 0; i < 26; ++i) {
		ll a = *min_element(v[i].begin(), v[i].end());
		for (ll j = 0; j < a; ++j) {
			cout << (char)('a' + i);
		}
	}
	cout << endl;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9;
const LL LINF = INF * INF;

const int MAX = 1 << 20;

LL t[MAX];
int n;
pair<PII, int> a[MAX];

void a1(int v, int tl, int tr, int pos, LL add)
{
	if (tl == tr)
		t[v] += add;
	else
	{
		int tm = (tl + tr) >> 1;
		if (pos <= tm)
			a1(v + v, tl, tm, pos, add);
		else
			a1(v + v + 1, tm + 1, tr, pos, add);
		t[v] = max(t[v + v], t[v + v + 1]);
	}
}

LL get(int v, int tl, int tr, int l, int r)
{
	if (l == tl && r == tr)
		return t[v];
	if (l > r || tl > tr)
		return 0;
	int tm = (tl + tr) >> 1;
	return max(get(v + v, tl, tm, l, min(tm, r)), get(v + v + 1, tm + 1, tr, max(tm + 1, l), r));
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("In.txt", "w", stdout);

	cin >> n;
	FOR(i, 0, n)
		cin >> a[i].X.X, a[i].Y = i;
	FOR(i, 0, n)
		cin >> a[i].X.Y;
	sort(a, a + n);
	
	FOR(i, 0, n)
	{
		int pl = a[i].Y;
		//debug(pl);
		LL que = get(1, 0, n - 1, 0, pl);
		a1(1, 0, n - 1, pl, que + a[i].X.Y);
	}
	
	cout << get(1, 0, n - 1, 0, n - 1) << endl;
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 10496
#include "bits/stdc++.h"
using namespace std;

const int N=2e5+20;

int n,a[N],num=1,ans;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);

	for(int i=1;i<=n;i++)
	{
		if(a[i]==num) num++;
		else ans++;
	}
	cout<<(ans==n?-1:ans);
}

Measured memory_bytes: 1024
# include<bits/stdc++.h>
using namespace std;
int a[105]={0},b[105]={0};

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	int long long  sum=0;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		sum=a[i]+sum;
	}
	int min=sum/(4*m);
	if(sum%(4*m)!=0)
	{
		min++;
	}
	sort(a,a+n);
	int book=0;
	for(int i=n-1;i>=0;i--)
	{
		if(a[i]>=min)
			book++;
		else	break;
	}
	if(book>=m)	printf("Yes");
	else	printf("No");
	return 0;
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define GO ll t; cin>>t; while(t--)
#define mod  1000000007
#define vect vector<long long int>
#define fore(p) for(auto& x:p)
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(), x.rend()
#define PY 3.141592653589793238
ll power(ll a,ll b){
    ll res = 1;
    while(b > 0)
    {
        if(b%2 == 11) res *= a;
        a *= a;
        b /= 2;
    }
    return res;
}
int main() 
{sevensins
    ll i,j,k,l,n;
    cout.precision(10);
    //GO
    {
        cin>>n;
        
        vect v(n);
        
        fore(v)
        cin>>x;
        
        vect dp(n,1e9);
        dp[0]=0;
        for(i=0;i<n;i++)
        {   
            for(j=i+1;j<=i+2;j++)
            if(j<n)
            dp[j] = min(dp[j] , dp[i] + abs(v[i]-v[j]));
        }
        
        cout <<dp[n-1]<<"\n";
    }
return 0;
}

Measured memory_bytes: 1792
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
bool cmp1(pii a, pii b)
{
	return a.fi+a.se < b.fi + b.se;
}
bool cmp2(pii a, pii b)
{
	return a.fi-a.se < b.fi - b.se;
}
signed main()
{
    fast;
  
    ll n,i,j;
    cin>>n;
    vector<pii> v;
    for(i=0;i<n;i++)
    {
    	ll x,y;
    	cin>>x>>y;
    	v.pb({x,y});
    }
    sort(v.begin(),v.end(),cmp1);
    ll ans=  v[n-1].fi+v[n-1].se - (v[0].fi+v[0].se);
    sort(v.begin(),v.end(),cmp2);
    ans=  max(ans,v[n-1].fi-v[n-1].se - (v[0].fi-v[0].se));
    cout<<ans;
}

Measured memory_bytes: 7404
#include <bits/stdc++.h>
#define LL long long
#define PLL pair<LL, LL>
#define x first
#define y second 
using namespace std;
const LL INF = (LL) 1e18 + 5;
//const LL MOD = (LL) 1e9 + 7;
const int MAXN = 2005;

LL n, dp[MAXN][MAXN], A[MAXN];
PLL ord[MAXN];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
		ord[i] = PLL(A[i], i);
	}
	
	sort(ord + 1, ord + 1 + n);
	for (int i = 1; i <= n; i++) {
		for (int l = 1; l <= n; l++) {
			int r = l + i - 1;
//			if (r > n) {
//				dp[i][l] = -INF;
//				continue;
//			}
			PLL p = ord[i];
			dp[i][l] = max(dp[i - 1][l] + p.x * abs(p.y - r), dp[i - 1][l + 1] + p.x * abs(p.y - l));
//			cout << i << ' ' << l << ' ' << dp[i][l] << '\n';
		}
	}
	
	cout << dp[n][1] << '\n';
	
	return 0;
}

Measured memory_bytes: 34992
/*
lakshaygpt28
Lakshay Gupta
*/

#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;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using vll = vector < ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;


#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 12;

ll a[N][N];

int main() {
    fast_io();
    ll n, d;
    cin >> n >> d;
    for (ll i = 0; i < n; i++) {
        for (ll j = 0; j < d; j++) {
            cin >> a[i][j];
        }
    }
    ll ans = 0;
    for (ll i = 0; i < n; i++) {
        for (ll j = i + 1; j < n; j++) {
            ll sum = 0;
            for (ll k = 0; k < d; k++) {
                sum += pow(a[i][k] - a[j][k], 2);
            }
            ll sq = sqrt(sum);
            if (sq * sq == sum) {
                ans++;
            }
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REPR(i,n) for (int i=(int)(n)-1;i>=0;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
#define tpl(...) make_tuple(__VA_ARGS__)
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1);
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};
typedef long long ll;
typedef pair<int,int> pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))>basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>&os,
const C& c){os<<'[';for(auto i=begin(c);i!=end(c);++i)os<<(i==begin(c)?"":" ")<<*i;return os<<']';}
template<class S,class T>ostream&operator<<(ostream &o,const pair<S,T>&t){return o<<'('<<t.first<<','<<t.second<<')';}
template<int N,class Tp>void output(ostream&,const Tp&){}
template<int N,class Tp,class,class ...Ts>void output(ostream &o,const Tp&t){if(N)o<<',';o<<get<N>(t);output<N+1,Tp,Ts...>(o,t);}
template<class ...Ts>ostream&operator<<(ostream&o,const tuple<Ts...>&t){o<<'(';output<0,tuple<Ts...>,Ts...>(o,t);return o<<')';}
template<class T>void output(T t,char z=10){if(t<0)t=-t,putchar(45);int c[20];
int k=0;while(t)c[k++]=t%10,t/=10;for(k||(c[k++]=0);k;)putchar(c[--k]^48);putchar(z);}
template<class T>void outputs(T t){output(t);}
template<class S,class ...T>void outputs(S a,T...t){output(a,32);outputs(t...);}
template<class T>void output(T *a,int n){REP(i,n)cout<<a[i]<<(i!=n-1?',':'\n');}
template<class T>void output(T *a,int n,int m){REP(i,n)output(a[i],m);}
template<class T>bool input(T &t){int n=1,c;for(t=0;!isdigit(c=getchar())&&~c&&c-45;);
if(!~c)return 0;for(c-45&&(n=0,t=c^48);isdigit(c=getchar());)t=10*t+c-48;t=n?-t:t;return 1;}
template<class S,class ...T>bool input(S&a,T&...t){input(a);return input(t...);}
template<class T>bool inputs(T *a, int n) { REP(i,n) if(!input(a[i])) return 0; return 1;}

int main() {
  int a,b;
  while(cin>>a>>b) {
    printf("%.10f\n", a*b/3.305785);
  }
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
long long n,t,ans,sum;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)	
		{
			ans++;
			sum += i;
			if (sum >= n)
				{
					cout << ans << endl;
					return 0;
				}
		}
	return 0;	
 } 

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  ll W, H, x, y;

  cin >> W >> H >> x >> y;

  bool multi = (x*2 == W && y*2 == H);

  cout << (W * H) / 2.0 << " " << multi << endl;

  return 0;
}


Measured memory_bytes: 256