akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main{

    public static void main(String args[]){

        // スキャナーの宣言
        Scanner sc = new Scanner(System.in);
        // 整数の入力
		int n = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        //HashMap<Integer, Hashmap<Integer, Integer>> map = new HashMap<Integer, Hashmap<Integer, Integer>>();
        //Map<Integer, Map<Integer,Integer>> map = new HashMap<Integer, Map<Integer,Integer>>();
        HashMap<String, Integer> map = new HashMap<String, Integer>();

        int a, b, max = 0;
        String key, max_key = "";
        //for文
        for(int i = 0; i < n; i++){
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
            for(int j = 0; j < i; j++){
                a = x[i] - x[j];
                b = y[i] - y[j];
                if(a < 0 && b < 0){
                    a = - a;
                    b = - b;
                }else if(a < 0 && b > 0){
                    a = - a;
                    b = - b;
                }else if(a < 0 && b == 0){
                    a = - a;
                }else if(a == 0 && b < 0){
                    b = - b;
                }
                key = a + " " + b;
                if(map.get(key) == null) map.put(key, 1);
                else map.put(key, map.get(key) + 1);
                if(map.get(key) > max){
                    max = map.get(key);
                    max_key = key;
                }
            }
        }

        int ans;
        if(map.get(max_key) == null) ans = 0;
        else ans = map.get(max_key);

        // 出力
        System.out.println(n - ans);

    }

}

Measured memory_bytes: 21972
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define ALL(x) (x).begin(),(x).end()
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int ans = 0;
    if(a^b) ans++;
    if(b^c) ans++;
    if(c^a) ans++;
    if(a==b&&b==c) ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if (s == u) --a;
    else --b;
    printf("%d %d\n", a,b);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
    string A,N,C,ans;
    cin >> A >> N >> C;
    cout << "A" << N.front() << "C"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
 
const int N = 500005;
ll x[N];
ll t[N];
int a[N][2];
int n;
 
int solve_greedy()
{
	int x[3] = {0,0,0}; int pos=n; int ext=0; int back=0;
	vector<ii> vec;
	for(int i=0;i<n;i++)
	{
		ext+=(a[i][0]==1&&a[i][1]==1);
		if(!(a[i][0]&&a[i][1])) vec.pb(mp(a[i][0],a[i][1]));
	}
	if(a[n-1][0]==1&&a[n-1][1]==1) back=1;
	n=vec.size();
	for(int i=0;i<n;i++)
	{
		a[i][0] = vec[i].fi; a[i][1] = vec[i].se;
	}
	//start sol edit here
	int maxmatch = -1;
	deque<int> S01; deque<int> S00; deque<int> S10;
	for(int i=0;i<n;i++)
	{
		if(a[i][0]==1&&a[i][1]==0) 
		{
			pos=i; break;
		}
		if(a[i][0]==0&&a[i][1]==0) 
		{
			S00.push_back(i);
		}
		else
		{
			if(!S00.empty())
			{
				maxmatch = max(maxmatch, S00.front()); S00.pop_front();
			}
			else
			{
				S01.pb(i);
			}
		}
	}
	for(int i=pos;i<n;i++)
	{
		assert(!(a[i][0]&&a[i][1]));
		if(a[i][0]==0&&a[i][1]==0)
		{
			if(!S10.empty())
			{
				maxmatch = max(maxmatch, S10.front()); S10.pop_front();
			}
			else 
			{
				S00.pb(i);
			}
		}
		else
		{
			S10.pb(i);
		}
	}
	while(S00.size()>2)
	{
		S00.pop_front(); S00.pop_front();
	}
	x[0] = S01.size(); x[1] = S00.size(); x[2] = S10.size();
	int maxnonmatch = -1;
	if(!S00.empty()) maxnonmatch = max(maxnonmatch, S00.back());
	if(!S01.empty()) maxnonmatch = max(maxnonmatch, S01.back());
	if(maxnonmatch<maxmatch) back=1;
	int ans=0;
	//cerr<<x[0]<<' '<<x[1]<<' '<<x[2]<<' '<<back<<'\n';
	if(x[2]==0&&!back)
	{
		if(x[0]==0)
		{
			if(x[1]&1) return 0+ext;
			else return 1+ext;
		}
		ans = x[0] - 1 + x[1];
		return ans+ext;
	}
	else
	{
		int ans = x[0] + x[2] + 1;
		if(x[1]&1) ans++;
		return ans+ext;
	}
}
 
ll solve(ll L)
{
	ll ans = 1;
	for(int i=0;i<n;i++)
	{
		ans+=2LL*(t[i]/(2*L));
		t[i]%=(2*L);
		if(t[i]==0)
		{
			a[i][0] = 1; a[i][1] = 1; ans--; continue;
		}
		ans++;
		if(2*(L - x[i]) >= t[i])
		{
			a[i][0] = 0;
		}
		else
		{
			a[i][0] = 1;
		}
		if(2*x[i] >= t[i])
		{
			a[i][1] = 0;
		}
		else
		{
			a[i][1] = 1;
		}
	}
	ans += solve_greedy();
	return (ans*L);
}
 
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	//freopen("shopping.in","r",stdin);	
	cin>>n; ll L; cin>>L;
	for(int i=0;i<n;i++)
	{
		cin>>x[i]; 
	}
	for(int i=0;i<n;i++)
	{
		cin>>t[i]; 
	}
	cout<<solve(L)<<'\n';
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  int n; string s; cin>>n>>s; int ans=0;
  for (int i=1; i<n; i++) {
    set<char> l,r;
    for (int j=0; j<i; j++) {
      l.insert(s[j]);
    }
    for (int j=i; j<n; j++) {
      r.insert(s[j]);
    }
    int cur = 0;
    for (char c: l) {
      if (r.count(c)) cur++;
    }
    ans = max(ans, cur);
  }
  cout<<ans<<endl;
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=105;
//i_am_noob
int n,a[10],x=0;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i];
	rep(n) x+=a[i];
	print1(x-(*max_element(a,a+n))/2);
	return 0;
}


Measured memory_bytes: 256
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it, len;
	fastio() {it=len=0;}
	inline char get()
	{
		if (it<len) return s[it++]; it=0;
		len=fread(s, 1, 100000, stdin);
		if (len==0) return EOF; else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while (c==' '||c=='\n') c=get();
		if (it>0) it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0; bool ng=0; char c; c=_buff.get();
	while (c!='-'&&(c<'0'||c>'9')) c=_buff.get();
	if (c=='-') ng=1, c=_buff.get();
	while (c>='0'&&c<='9') r=r*10+c-'0', c=_buff.get();
	return ng?-r:r;
}
template <class T> inline void putnum(T x)
{
	if (x<0) putchar('-'), x=-x;
	register short a[20]={}, sz=0;
	while (x) a[sz++]=x%10, x/=10;
	if(sz==0) putchar('0');
	for (int i=sz-1; i>=0; i--) putchar('0'+a[i]);
}
inline char getreal() {char c=_buff.get(); while (c<=32) c=_buff.get(); return c;}
ll qpow(ll x, ll k) {return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
int main()
{
	int a, b, c;
	cin>>a>>b>>c;
	if ((c-b)%2==0) puts("Alice");
	else puts("Borys");
	return 0;
}


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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);}//最小公倍数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//void print(){}

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

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

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

int make_num(char a,char b,char c){
    int num=(a-'0')*100+(b-'0')*10+(c-'0');
    return num;
}

double temp(int t,int h){
    return (double)t-h*0.006;
}

signed main(){
//    IOS;
    CIN(N,T);
    vi c(N),t(N);
    rep(i,N)cin>>c[i]>>t[i];
    int ans=INF;
    rep(i,N){
        if(t[i]<=T)ans=min(ans,c[i]);
    }
    printf(ans==INF?"TLE":"%d\n",ans);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <cstdio>
using namespace std;
 
#define EPS 1e-7
 
typedef complex<double> P;
#define X real()
#define Y imag()
 
double cross(P a,P b){ return (a.X*b.Y)-(a.Y*b.X); }
 
int isIntersected(P a1,P a2,P b1,P b2)
{
        return cross(a2-a1,b1-a1) * cross(a2-a1,b2-a1) < EPS &&
                   cross(b2-b1,a1-b1) * cross(b2-b1,a2-b1) < EPS;
}
 
int main()
{
        double a,b,c,d,e,f,g,h;
 
        while(~scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&a,&b,&c,&d,&e,&f,&g,&h))
        {
                P aa(a,b), bb(c,d), cc(e,f), dd(g,h);
                cout<<( isIntersected(aa,cc,bb,dd)>0.0 || isIntersected(bb,dd,aa,cc)>0.0 ? "YES" : "NO" )<<endl;
        }
 
        return 0;
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    char a[10][10];
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
            cin >> a[i][j];
        }
    }
    cout << a[0][0] << a[1][1] << a[2][2] << endl;
    }

Measured memory_bytes: 256
import sys
inputs = sys.stdin.readline
N, M = map(int,inputs().split())
K = [None]*M
for t in range(M):
	x, y, z = map(int,inputs().split())
	K[t] = (x, y)
c = 0

U = [0]*(N+1)

for k in K:
	if U[k[0]] and U[k[1]]:
		a = U[k[0]]
		b = U[k[1]]
		while(U[a] != a ):
			a = U[a]
		while(U[b] != b ):
			c = b
			b = U[b]
			U[c] = a
		U[b] = a
	elif U[k[1]]:
		U[k[0]] = U[k[1]]
	elif U[k[0]]:
		U[k[1]] = U[k[0]]
	else:
		U[k[0]] = k[0]
		U[k[1]] = k[0]

ans = 0
c = 0
group = set()
for n in range(1,N+1):
	if U[n] == 0:
		ans += 1
		continue
	elif n == U[n]:
		ans += 1
		group.add(U[n])
	elif U[n] in group:
		continue
	else:
		while(n != U[n] and U[n] not in group):
			group.add(U[n])
			n = U[n]
		group.add(U[n])
print(ans)

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

int main () {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  for (int i = 0;;i++) {
    C -= B;
    if (C <= 0) {
      break;
    }
    A -= D;
    if (A <= 0) {
      break;
    }
  }
  if (C <= 0) {
    cout << "Yes" << endl;
  }
  if (A <= 0) {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;

int main(){
  int h,w;
  vector<vector<int>> map;
  cin >> h >> w;
  for(int i=0; i<h; ++i){
    vector<int> tmp;
    for(int j=0; j<w; ++j){
      int itmp;
      cin >> itmp;
      tmp.push_back(itmp);
    }
    map.push_back(tmp);
  }
  int ans = 1000000;
  for(int ir=0; ir<h; ++ir){
    for(int jr=0; jr<w; ++jr){
      int tmp = 0;
      for(int i=0; i<h; ++i){
        for(int j=0; j<w; ++j){
          int jtmp = abs(jr-j);
          int itmp = abs(ir-i);
          if(itmp<=jtmp){
            tmp += itmp * map[i][j];
          }else if(jtmp<itmp){
            tmp += jtmp * map[i][j];
          }
        }
      }
      if(tmp<ans){ans=tmp;}
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3164
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var AB = ReadSplitInt();
            var ans = AB[0] - AB[1] * 2;
            Println(ans < 0 ? 0 : ans);
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());
        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}



Measured memory_bytes: 11220
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>

#define INF 1e9
#define LINF 1e19
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;
     
const ll MOD = 1e9 + 7;

int main(){
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ch = 0, m;
    if(x > y){
      ch = 0;
      m  = y;
    }
    else {
      ch = 1;
      m = x;
    }
    ll res = 0;
    res = min((a + b) * m, 2 * c * m);
    if(ch == 0){
      m = x - m;
      res += min(a * m, 2 * c * m);
    }
    else {
      m = y - m;
      res += min(b * m, 2 * c * m);
    }
    cout << res << endl;
}





Measured memory_bytes: 3616
#include<iostream>
#include<string>

using namespace std;
int main() {
    string s;
    cin >> s;
    int ret = 0;
    for (int i = 0; i < 3; ++i) {
        if (s[i] == '1')
            ret++;
    }
    cout << ret << "\n";
    return 0;
}

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

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

int main() {
    int n, k; cin >> n >> k;
    int r, s, p; cin >> r >> s >> p;
    int ans = 0;
    string str; cin >> str;
    rep(i,k) {
        if (str[i] == 'r') ans += p;
        if (str[i] == 's') ans += r;
        if (str[i] == 'p') ans += s;
    }
    rng(i,k,n) {
        if (str[i] == str[i-k]) {
            str[i] = '*';
            continue;
        }
        if (str[i] == 'r') ans += p;
        if (str[i] == 's') ans += r;
        if (str[i] == 'p') ans += s;
    }
    cout << ans << endl;
    return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;

  vll a(n);
  REP(i, n)
    cin >> a[i];
  sort(a.begin(), a.end());

  ll ai = a[n-1];
  auto aj_high = lower_bound(a.begin(), a.end(), ai/2);
  ll aj = *aj_high;

  if(ai % 2 == 1){
    auto aj_low = aj_high-1;
    if(abs(*aj_low - ai/2) <= abs(*aj_high - ai/2 - 1))
      aj = *aj_low;
  }
  else{
   auto aj_low = aj_high-1;
    if(abs(*aj_low - ai/2) <= abs(*aj_high - ai/2))
      aj = *aj_low;
  }

  cout << ai << " " << aj << endl;





}


Measured memory_bytes: 1024
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i,n)for(int i=0;i<n;i++)

int N,M;
int P[100000],Y[100000];
vector<int>yd[100001];

int main(){
	scanf("%d%d",&N,&M);
	rep(i,M)scanf("%d%d",&P[i],&Y[i]),yd[P[i]].push_back(Y[i]);
	rep(i,N)sort(yd[i+1].begin(),yd[i+1].end());
	rep(i,M)printf("%012lld\n",ll(P[i])*1000000+int(lower_bound(yd[P[i]].begin(),yd[P[i]].end(),Y[i])-yd[P[i]].begin())+1);
}

Measured memory_bytes: 7680
#include <cstdio>
#include <iostream>
#include <list>
#include <string>
using namespace std;

int main() {
	int n,key;
	char buf[20];
	string command;
	list<int> lst;
	scanf("%d",&n);
	for(int i=0; i<n; ++i) {
		scanf("%s",buf);
		command = buf;
		if(command=="insert") {
			scanf("%d",&key);
			lst.push_front(key);
		} else if(command=="delete") {
			scanf("%d",&key);
			for(auto itr=lst.begin(); itr!=lst.end(); ++itr) {
				if((*itr)==key) {
					lst.erase(itr);
					break;
				}
			}
		} else if(command=="deleteFirst") {
			lst.pop_front();
		} else if(command=="deleteLast") {
			lst.pop_back();
		}
	}

	for(auto itr=lst.begin(); itr!=--(lst.end()); ++itr) {
		printf("%d ",*itr);
	}
	printf("%d\n",lst.back());
	return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a.at(i);
    }
    int ans = 0;
    for (int j = 0; j < n - 2; ++j) {
        if (a.at(j) < a.at(j + 1) && a.at(j + 1) < a.at(j + 2)) ++ans;
        if (a.at(j) > a.at(j + 1) && a.at(j + 1) > a.at(j + 2)) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	map<int, int> mp;
	FOR(i, n) {
		int a;
		cin >> a;
		mp[a]++;
		mp[a-1]++;
		mp[a+1]++;
	}
	int ma = -1;
	for (auto itr = mp.begin(); itr != mp.end(); itr++) {
		ma = max(ma, itr->second);
	}
	cout << ma << endl;
	return 0;
}

Measured memory_bytes: 4736
//108A
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int k=0;
    cin >> k;
    
    if(k%2==0){
        cout << pow(k/2, 2); //累乗
    }else{
        cout << (1+ k/2)*(k/2);
    }
}

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

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

  int n, m, x;
  cin >> n >> m >> x;

  int a[n][m+1];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m+1; ++j) {
      cin >> a[i][j];
    }
  }

  int ans = MAX;

  for (int bit = 0; bit < (1<<n); ++bit) {
    int cost = 0;
    int score[m+1];

    memset(score, 0, sizeof(score));

    for (int i = 0; i < n; ++i) {
      if (bit & (1<<i)) {
        cost += a[i][0];
        for (int j = 1; j < m+1; ++j) score[j] += a[i][j];
      }
    }

    bool ok = true;
    for (int i = 1; i < m+1; ++i) if (score[i] < x) ok = false;

    if (ok) ans = min(ans, cost);
  }

  cout << (ans == MAX ? -1 : ans) << '\n';

  return (0);
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    
    bool flag=true;
    if(n==1) flag=false;
    if(n%2!=0) flag=false;
    rep(i,n/2){
        if(s[i]!=s[n/2+i]) flag=false;
    }
    
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

int main(int argc, char *argv[]){
    int N, K;
    std::cin >> N >> K;
    std::deque<long int> V;
    long int v;
    for(int i=0; i<N; ++i){
        std::cin >> v;
        V.push_back(v);
    }

    std::vector<long int> sumValue;
    std::vector<long int> subsequent;
    int left,right;
    int lSubsequent;
    long int sumSubsequent;
    int dequeIdx;
    int nGet, nReturn;
    int R = N < K ? N : K;
    for(lSubsequent=0; lSubsequent<=R; ++lSubsequent){
        for(left=N-lSubsequent; left<=N; ++left){
            right = left+lSubsequent;
            subsequent.clear();
            for(dequeIdx=left; dequeIdx<right; ++dequeIdx){
                subsequent.emplace_back(V[dequeIdx%N]);
            }
            std::sort(subsequent.begin(),subsequent.end());
            sumSubsequent = 0;
            for(dequeIdx=0; dequeIdx<lSubsequent; ++dequeIdx){
                if(dequeIdx<K-lSubsequent && subsequent[dequeIdx]<0){
                    continue;
                }
                sumSubsequent += subsequent[dequeIdx];
            }
            sumValue.emplace_back(sumSubsequent);
        }
    }

    std::cout << *std::max_element(sumValue.begin(),sumValue.end()) << std::endl;
    return 0;
}


Measured memory_bytes: 256
#define REP(i, t, n)  for (int i = t; i < n; i++)
#define ALL(n)        (n).begin(),(n).end()
#include <limits.h>
#include <stdio.h>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <functional>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <numeric>

using namespace std;

typedef bool               BOOL;
typedef short              WORD;
typedef unsigned short     U_WORD;
typedef long               DWORD;
typedef unsigned long      U_DWORD;
typedef long long          QWORD;
typedef unsigned long long U_QWORD;

#define N (4)

map<char, int> inputMap;

void solve_main()
{
	string inputS;

	cin >> inputS;

	REP(i, 0, N) {
		inputMap[inputS[i]]++;
	}

	if (2 == inputMap.size()) {
		if (2 == inputMap[inputS[0]]) {
			cout << "Yes" << endl;
			return;
		}
	}

	cout << "No" << endl;
	return;
}

int main()
{
#ifdef FOR_IDE
	ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
#endif

	solve_main();
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <utility>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int , int>P;
typedef pair<P,P>PP;//wall dist y x
int M,N,mv[5]={-1,0,1,0,-1},res;
char B[105][105];
P d[105][105];

struct Order
{
	bool operator ()(PP const&a, PP const&b) const
	{
		if(a.first.first==b.first.first)
			return a.first.second>b.first.second;
		return a.first.first>b.first.first;
	}
};

priority_queue<PP,vector<PP>,Order>Q; //need finit

void Pset(int y, int x)
{
	d[y][x]=make_pair(0,0);
	Q.push(make_pair(make_pair(0,0),make_pair(y,x)));
}

int main()
{
	for (;scanf("%d%d\n" ,&N,&M),N+M;)
	{
		res=100000000;
		memset(d,0x7f, sizeof (d));
		for(int i=0;i<=M+1;i++)for(int j=0;j<=N+1;j++)B[i][j]='.';
		for(int i=0;i<M;i++)gets(B[i+1]+1);
		for(int i=0;i<=M+1;i++){B[i][N+1]='.';B[i][N+2]=0;}
		N++;M++;
		Q.push(make_pair(make_pair(0,0),make_pair(0,0)));
		while (!Q.empty())
		{
			PP tmp=Q.top();Q.pop();
			int y=tmp.second.first;
			int x=tmp.second.second;
			P cost=tmp.first;
			if (d[y][x]<cost)continue;
			if (B[y][x]=='&' )
			{
				res=min(res,cost.first);
				continue ;
			}
			for (int i=0;i<4;i++)
			{
				int ny=y+mv[i];
				int nx=x+mv[i+1];
				if (ny<0||ny>M||nx<0||nx>N) continue;
				P nc=make_pair(cost.first+(B[y][x]=='#' &&B[ny][nx]!= '#'),cost.second+1);
				if (nc<d[ny][nx])
				{
					d[ny][nx]=nc;
					Q.push(make_pair(nc,make_pair(ny,nx)));
				}
			}
		}
		printf( "%d\n" ,res);
	}
}
  

Measured memory_bytes: 1432
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(){
    int N, K;
    int ans;

    //input
    cin >> N >> K;

    if(K == 1){
        ans = 0;
    }else{
        ans = N - K;
    }

    //output
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    List<Integer>[] lists = new ArrayList[n];
    int[] dp = new int[n];

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        for (int i=0; i<n; i++) lists[i] = new ArrayList<>();

        for (int i=0; i<m; i++) {
            int s = sc.nextInt() - 1;
            int t = sc.nextInt() - 1;
            lists[s].add(t);
        }

        Arrays.fill(dp, -1);

        int ret = 0;

        for (int i=0; i<n; i++) {
            ret = Math.max(ret, rec(i));
        }

        System.out.println(ret);

    }

    int rec(int v) {
        if (dp[v] != -1) return dp[v];

        int ret = 0;

        for (int u: lists[v]) {
            if (dp[u] == -1) rec(u);
            ret = Math.max(ret, dp[u] + 1);
        }

        return dp[v] = ret;
    }
}



Measured memory_bytes: 71568
#include<iostream>
#include<string>
using namespace std;
int main(){
	string A,B;
	int c,d,e,f,i;
	cin>>A>>B;
	c=A.size();
	d=B.size();
	if(c>d)cout<<"GREATER";
	if(c==d){
		if(A==B){cout<<"EQUAL";
		}else{
			for(i=0;i<c;i++){
				if(A[i]!=B[i]){
					if(A[i]=='0'){
						e=0;
					}
					if(B[i]=='0'){
						f=0;
					}
					if(A[i]=='1'){
						e=1;
					}
					if(B[i]=='1'){
						f=1;
					}
					if(A[i]=='2'){
						e=2;
					}
					if(B[i]=='2'){
						f=2;
					}
					if(A[i]=='3'){
						e=3;
					}
					if(B[i]=='3'){
						f=3;
					}
					if(A[i]=='4'){
						e=4;
					}
					if(B[i]=='4'){
						f=4;
					}
					if(A[i]=='5'){
						e=5;
					}
					if(B[i]=='5'){
						f=5;
					}
					if(A[i]=='6'){
						e=6;
					}
					if(B[i]=='6'){
						f=6;
					}
					if(A[i]=='7'){
						e=7;
					}
					if(B[i]=='7'){
						f=7;
					}
					if(A[i]=='8'){
						e=8;
					}
					if(B[i]=='8'){
						f=8;
					}
					if(A[i]=='9'){
						e=9;
					}
					if(B[i]=='9'){
						f=9;
					}
				
					if(e>f){
						cout<<"GREATER";
					}else{
						cout<<"LESS";
					}
					break;
				}
		        }
		}
	}
	if(c<d)cout<<"LESS";	
	
}

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

int N;
string first, second;
int mod = 1e9 + 7;

int main() {
    cin >> N >> first >> second;
    bool vert = (first[0] == second[0]);
    long long ans = vert? 3: 6;
    for (int i = (vert? 1: 2); i < N; i++) {
        if (first[i] == second[i]) {
            if (vert) {
                ans = (2 * ans) % mod;
            }
            vert = true;
        } else {
            if (vert) {
                ans = (2 * ans) % mod;
            } else {
                ans = (3 * ans) % mod;
            }
            ++i;
            vert = false;
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 256
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define int long long

int32_t main(){
	int a, b, k;
	cin >> a >> b >> k;
	if (k <= a){
		cout << a - k << ' ' << b;
	}else{
		cout << "0 " << max(0ll, (a + b) - k); 
	}
}


Measured memory_bytes: 3596
import collections
h,w=map(int,input().split())
a=""
for i in range(h):
    a+=input()
f,o=1,0
for i in collections.Counter(a).values():
    f+=i//4
    o+=i%4%2
print("Yes" if f>(h//2)*(w//2) and o<=h%2*w%2 else "No")

Measured memory_bytes: 3316
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    ($arg:expr) => (println!("{:?}",$arg));
}


#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}


use std::cmp;
use std::collections::HashMap;





fn main() {

    input! { 
       n: usize,
       a : [i64;n],
    }

    let mut ans = 0_i64;
    let mut a = a;
    a.sort_by(|x,y|{
        if  x.abs() < y.abs() {
            cmp::Ordering::Less
        }
        else if  x.abs() == y.abs() {
            cmp::Ordering::Equal
        }
        else{
            cmp::Ordering::Greater
        }
    });
    let mut count = 0;
    let mut flag = false;
    for item in &a{
        if item < &0 {
            count +=1;
        }
        else if item == &0{
            flag = true;
        }
        ans += item.abs();
    }

    mydbg!(a);

    
    if(flag == false && count % 2 == 1){
        ans -= a[0].abs()*2;
    }
    
    println!("{}",ans);


}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define brep(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define pb push_back
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vbl = vector<bool>;
using vint = vector<int>;
using vstr = vector<string>;
static inline void ignore_ret(int x) {x++;}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline map<T,T> factorize(T n){map<T,T>r;for(T i=2;i*i<=n;i++){while(n%i== 0){r[i]++;n/=i;}}if(n!=1)r[n]=1;return r;}
template<class T> inline T gcd_vec(vector<T>v){T r=v[0];for(T i=1;i<v.size();i++)r=gcd(r,v[i]);return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v[0];for(T i=1;i<v.size();i++)r=lcm(r,v[i]);return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){if(u.size()<v.size())return 0;T r=0;for(T i=0;i<u.size();i++)r+=u[i]*v[i];return r;}
template<class T> inline T sum(vector<T>v){return accumulate(all(v),0LL);}

void solve(ll N, vector<ll> p) {
  sort(all(p));
  cout << sum(p) - p[p.size() - 1] / 2 << endl;
}

int main() {
  ll N;
  ignore_ret(scanf("%lld",&N));
  vector<ll> p(N);
  for(int i = 0 ; i < N ; i++){
    ignore_ret(scanf("%lld",&p[i]));
  }
  solve(N, move(p));
  return 0;
}


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

int main() {

    int A, B;
    
    cin >> A >> B;

    if ((A + (A-1)) > (B + (B-1)) && (A + (A-1)) > (A + B)) {
        cout << A + (A-1) << endl;
    }
    else if ((B + (B-1)) > (A + (A-1)) && (B + (B-1)) > (A + B)) {
        cout << B + (B-1) << endl;
    }
    else {
        cout << A + B << endl;
    }
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

int H,W,K;
vector<string> fd;
int mbh,mbw;

int calc(int bh,int bw){
    int ret=0;
    for(int h=0;h<H;++h){
        if((bh>>h)&1)continue;
        for(int w=0;w<W;++w){
            if((bw>>w)&1)continue;
            if(fd[h][w]=='#')ret++;
        }
    }
    return ret;
}

signed main(){
    cin>>H>>W>>K;
    for(int i=0;i<H;++i){
        string s;
        cin>>s;
        fd.push_back(s);
    }
    mbh=1<<H;
    mbw=1<<W;
    int ans=0;
    for(int i=0;i<mbh;++i){
        for(int j=0;j<mbw;++j){
            if(K==calc(i,j))ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define dame {cout<< "NO" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,M; cin>>N>>M;
    map<ll,ll> mp;
    rep(i,M){
        ll x,y; cin>>x>>y;
        ++mp[x];
        ++mp[y];
    }
    for(auto aa: mp){
        if(aa.second%2==1) dame;
    }
    cout<< "YES" <<"\n";

}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

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

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N, D, X;
    cin >> N >> D >> X;

    int cnt = 0;
    REP(i, N) {
        int a; cin >> a;

        int j = 0;
        while(a * j + 1 <= D) cnt++, j++;
    }

    print(X + cnt);
    
}


Measured memory_bytes: 3604
n=int(input())
a_dict={}
for i in range(n):
    a=input()
    if a not in a_dict:
        a_dict[a]=0
    else:
        a_dict[a]+=1
# moji=[i for i,j in a_dict.items() if j==max(a_dict.values()) ]
moji=[]
j=max(a_dict.values())
for i,k in a_dict.items():
    if k==j:
        moji.append(i)
moji=sorted(moji)
for i in moji:
    print(i)

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

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    for (int i=0; i<2; i++) {
        int nx, ny;
        int xd = x2 - x1;
        int yd = y2 - y1;
        nx = x2 - yd;
        ny = y2 + xd;
        cout << nx << " " << ny;
        if (i == 1) cout << endl;
        else cout << " ";
        x1 = x2; x2 = nx;
        y1 = y2; y2 = ny;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>v(n+1);
    int dp[n+1]={INT_MAX};dp[1]=0;
    for(int i=1;i<=n;i++)
        cin>>v[i];
    for(int i=2;i<=n;i++){
        dp[i]=INT_MAX;
        for(int j=1;j<=2;j++){
           if(i>j){
               dp[i]=min(dp[i],abs(v[i]-v[i-j])+dp[i-j]);
           }
        }//cout<<dp[i]<<" ";
    }
    cout<<dp[n];
}

Measured memory_bytes: 4032
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int n,m;
long long w;
char s[100005],t[100005];
map<long long,char>c;
int main()
{
	scanf("%d%d%s%s",&n,&m,s+1,t+1);
	w=(long long)n*(long long)m/(long long)__gcd(n,m);
	for(int i=1;i<=n;++i) c[(long long)(i-1)*(long long)(w/n)+1]=s[i];
	for(int i=1;i<=m;++i) if(c[(long long)(i-1)*(long long)(w/m)+1]&&c[(long long)(i-1)*(long long)(w/m)+1]!=t[i]) {printf("-1");return 0;}
	printf("%lld",w);
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    int n;cin>>n;
    vii a(n);
    rep(i,n){
        cin>>a[i].F;
        a[i].S=i;
    }
    sort(all(a));
    int cnt=1,ans=0;
    for(int i=1;i<n;++i){
        if(a[i-1].S<a[i].S)cnt++;
        else{
            ans=max(ans,cnt);
            cnt=1;
        }
    }
    ans=max(ans,cnt);
    cout<<n-ans<<endl;
}

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

using namespace std;

typedef long long int lli ;

lli i,j,k,l,m,n,t,a,b,c,d,x,y,sum=0,total=0;

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

    //freopen("Input.txt","r",stdin);

    cin>>n>>m;

    lli profit[n+1]={0},weight[n+1]={0},knapsack[n+1][m+1];

    for(i=1 ; i<=n ; i++)
    {
        cin>>weight[i]>>profit[i];
    }

    for(i=0 ; i<=n ; i++)
    {
        for(j=0 ; j<=m ; j++)
        {
            if(i==0 || j==0)
            {
                knapsack[i][j]=0;
            }
            else if(weight[i] <= j)
            {
                knapsack[i][j]=max(profit[i]+knapsack[i-1][j-weight[i]] , knapsack[i-1][j]);
            }
            else knapsack[i][j]=knapsack[i-1][j];
        }
    }
    cout<<knapsack[n][m]<<"\n";
}

Measured memory_bytes: 79232
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
using namespace std;

int factorial(int n)
{
  return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n;
}
int main()
{
  	long long int n,temp1,temp2;
  	cin>>n;
  	vector<pair<int,int> > v;
  	v.resize(n);
  	for(long long int i=0;i<n;i++)
  	{
        cin>>temp1>>temp2;
        v[i].first=temp1;
        v[i].second=temp2;
  	}
  	long double ans=0;
  	long long int a,b;
  	for(int i=0;i<n;i++)
  	{
        for(int j=i;j<n;j++)
        {
            a=abs(v[i].first-v[j].first);
            a*=a;
            b=abs(v[i].second-v[j].second);
            b*=b;
            ans+=sqrt(b+a)*2;
        }
  	}
  	printf("%0.10llf",ans/n);
}


Measured memory_bytes: 256