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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void anss(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  ll a,b,c;cin>>a>>b>>c;
  cout<<a+b+c-max({a,b,c})<<endl;
  return 0;
}

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

A = str(N//2)
B = str(N-int(A))

ans1,ans2 = 0,1
for i in range(len(A)):
  ans1 += int(A[i])
for i in range(len(B)):
  ans1 += int(B[i])

B = str(N-1)

for i in range(len(B)):
  ans2 += int(B[i])

ans = min(ans1,ans2)

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define int long long
typedef pair<int,int>P;
#define F first
#define S second

int dp[100009];

signed main(){
  int n,m;
  cin>>n>>m;
  r(i,m){
    int a,b;
    cin>>a>>b;a--;
    dp[a]++;
    dp[b]--;
  }
  r(i,n+1){
    dp[i+1]+=dp[i];
  }
  int sum=0;
  r(i,n)if(dp[i]==m)sum++;
  cout<<sum<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf (int)1e16
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
int n;
int a[114514 * 3];
vector<int>ansl, ansr;
priority_queue<int, vector<int>, greater<int>>l;
priority_queue<int>r;
int suml = 0, sumr = 0;
int ans = -inf;
signed main() {
	cin >> n;
	rep(i, n * 3) {
		cin >> a[i];
		if (i < n) {
			l.push(a[i]);
			suml += a[i];

		}
		else if (2 * n <= i) {
			r.push(a[i]);
			sumr += a[i];
		}
	}
	ansl.push_back(suml);
	for (int i = n; i < 2 * n; i++) {
		l.push(a[i]);
		suml += a[i];
		suml -= l.top();
		l.pop();
		ansl.push_back(suml);
	}
	ansr.push_back(sumr);
	for (int i = 2 * n - 1; i >= n; i--) {
		r.push(a[i]);
		sumr += a[i];
		sumr -= r.top();
		r.pop();
		ansr.push_back(sumr);
	}
	reverse(ansr.begin(), ansr.end());
	for (int i = n; i <= 2 * n; i++) {
		ans = max(ans, ansl[i - n] - ansr[i - n]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 6516
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define F first
#define S second

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

#define max(a,b) a>b?a:b
#define min(a,b) a>b?b:a

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    std::map<int, int> mp;
    std::vector<int> a(3);
    for(int i = 0; i <=2; i++) {
        cin>>a[i];
        mp[a[i]]++;
    }
    for(int i = 0; i <=2; i++) {
        if(mp[a[i]] == 2){
            cout<<"Yes\n";
            return 0;
        }
    }

        cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	cout << min(a,b)+min(c,d) << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	int n = in();
	map<int, bool>mp;
	REP(i, n) {
		int foo = in();
		if (mp[foo])mp.erase(foo);
		else mp[foo] = true;
	}
	cout << mp.size() << endl;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,l,r) for(int i=l;i<=r;i++)
int main()
{   //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll int n,w;
    cin>>n>>w;
    ll int wt[n],val[n];
    for(int i=0;i<n;i++)
        cin>>wt[i]>>val[i];

    ll int k[n+1][w+1];
     int i,j;
    for( i=0;i<=n;i++)
    {
        for(j=0;j<=w;j++)
        {
            if(i==0 || j==0)k[i][j]=0;
            else if (wt[i-1]<=j)
                k[i][j]= max(val[i-1]+k[i-1][j-wt[i-1]],k[i-1][j]);
            else k[i][j]=k[i-1][j];
        }
    }
     
   cout<<k[n][w]<<endl;
    return 0;
}

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

#define BUF_SIZE 30

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

struct prod {
    int value;
    int weight;
};

#define NUM_MAX 100
#define WEIGHT_MAX 10000
#define max(a,b) ((a) > (b) ? (a) : (b))

int main(void) {
    int num, w_sum;
    get_int2(&num, &w_sum);
    struct prod ps[NUM_MAX];
    int i, j;
    for(i = 0; i < num; i++) {
        get_int2(&ps[i].value, &ps[i].weight);
    }

    static int vals[WEIGHT_MAX+1];

    for(i = 1; i <= num; i++) {
        int v = ps[i-1].value;
        int w = ps[i-1].weight;
        for(j = w; j <= w_sum; j++) {
            vals[j] = max(vals[j-w]+v, vals[j]);
        }
    }
    printf("%d\n", vals[w_sum]);
    return 0;
}



Measured memory_bytes: 2112
/*
	ID: sixathofpain
	TASK: friday
	LANG: C++   

*/


//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;
	
    // freopen("friday.in","r",stdin);
    // freopen("friday.out","w",stdout);

    int n;
    cin>>n;
    int ans = 0;
    ans = (n/500)*1000;
    n%=500;
    ans = ans + (n/5)*5;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
    int n,m;
    int xc,yc;
    int x[200],y[200];
    int a[1000],b[1000];
    while(true){
    cin>>m;
    if(m==0)
        break;
    for(int i=0;i<m;i++)
        cin>>x[i]>>y[i];
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int i=0;i<n;i++){
        int t=0;
        for(int j=0;j<m;j++){
            for(int k=0;k<n;k++){
                if(a[i]-x[0]+x[j]==a[k]&&b[i]-y[0]+y[j]==b[k])
                    t++;
            }
        }
        if(t==m){
            xc=a[i]-x[0];
            yc=b[i]-y[0];
        }
    }
    cout<<xc<<" "<<yc<<endl;
    }
    return 0;
}
 

Measured memory_bytes: 1172
#include <cstdio>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <math.h>
using namespace std;
#define maxn 33
int a[maxn][maxn];
int b[maxn][maxn];
long long ans = 0;
long long maxx = 0;
void init(int h, int w)
{
	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= w; j++)
			a[i][j] = b[i][j];
	}
}
void ref(int h, int w)
{
	int y[maxn];
	for (int i = 1; i <= w; i++)
	{
		memset(y, 0, sizeof(y));
		int x = 0;
		for (int j = h; j >= 1; j--)
		{
			if (a[j][i] != -1)
			{
				y[x++] = a[j][i];
				a[j][i] = -1;
			}
		}
		while (x)
		{
			a[h - x + 1][i] = y[x - 1];
			x--;
		}
	}
}
bool check(int h, int w, int k, int l)
{
	int flag = 0;
	for (int i = 1; i <= h; i++)
	{
		int x = 1;
		for (int j = 2; j <= w; j++)
		{
			if (a[i][j] == a[i][j - 1] && a[i][j] != -1)
			{
				x++;
			}
			else
			{
				if (x >= k)
				{
					ans += pow(2, l)*a[i][j - 1] * x; 
					for (int m = 1; m <= x; m++)
						a[i][j-m] = -1;
					flag = 1;
				}
				x = 1;
			}
		}
		if (a[i][w] == a[i][w - 1] && a[i][w] != -1 && x >= k)
		{
			ans += pow(2, l)*a[i][w] * x;
			for (int m = 0; m < x; m++)
				a[i][w - m] = -1;
			flag = 1;
			x = 1;
		}
	}
	
	return flag;
}
int main()
{
	int h, w, k;
	cin >> h >> w >> k;
	char s[maxn];
	for (int i = 1; i <= h; i++)
	{
		scanf("%s", s);
		for (int j = 1; j <= w; j++)
			b[i][j] = s[j - 1] - '0';
	}
	for (int i = 1; i <= h; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			ans = 0;
			init(h, w);
			a[i][j] = -1;		
			ref(h, w);	
			int l = 0;
			while (check(h, w, k, l))
			{
				ref(h, w);			
				l++;
			}
			if (ans > maxx)
				maxx = ans;
		}
	}
	cout << maxx << endl;



	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int N;
	string S;
	cin >> N >> S;
	for (int i = 0; i < S.size(); i++) {
		cout <<  (char)(65 + (S[i] + N -65)%26) ;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <set>
# include <map>
# include <stack>
using namespace std;
# define M_PI 3.141592
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define pri_max 60000
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;


int main()
{
	map<char, string> enc;
	map<string, char> dec;
	for (char i = 'A'; i <= 'Z'; i++)
	{
		stringstream ss;
		bitset < 5 > b(i-'A');
		ss << b;
		enc.insert(make_pair(i, ss.str()));
	}
	enc[' '] = "11010";
	enc['.'] = "11011";
	enc[','] = "11100";
	enc['-'] = "11101";
	enc['\''] = "11110";
	enc['?'] = "11111";

	dec["101"] = ' ';
	dec["000000"] = '\'';
	dec["000011"] = ',';
	dec["10010001"] = '-';
	dec["010001"] = '.';
	dec["000001"] = '?';
	dec["100101"] = 'A';
	dec["10011010"] = 'B';
	dec["0101"] = 'C';
	dec["0001"] = 'D';
	dec["110"] = 'E';
	dec["01001"] = 'F';
	dec["10011011"] = 'G';
	dec["010000"] = 'H';
	dec["0111"] = 'I';
	dec["10011000"] = 'J';
	dec["0110"] = 'K';
	dec["00100"] = 'L';
	dec["10011001"] = 'M';
	dec["10011110"] = 'N';
	dec["00101"] = 'O';
	dec["111"] = 'P';
	dec["10011111"] = 'Q';
	dec["1000"] = 'R';
	dec["00110"] = 'S';
	dec["00111"] = 'T';
	dec["10011100"] = 'U';
	dec["10011101"] = 'V';
	dec["000010"] = 'W';
	dec["10010010"] = 'X';
	dec["10010011"] = 'Y';
	dec["10010000"] = 'Z';

	string s;
	while (getline(cin,s))
	{
		string x, y, z;
		for (int i = 0; i < s.size(); i++)x += enc[s[i]];

		for (int i = 0; i < x.size(); i++)
		{
			y += x[i];
			if (dec.count(y))
			{
				z += dec[y];
				y = "";
			}
		}
		cout << z << endl;

	}

}

Measured memory_bytes: 1224
package main

import "fmt"

func main() {
	var h [300][2]int
	var i int
	i = 0
	for true {
		fmt.Scanf("%d%d\n", &h[i][0], &h[i][1])
		if h[i][0] == 0 {
			if h[i][1] == 0 {
				break
			}
		}
		i++

	}
	for j := 0; j < i; j++ {

		for n := 0; n < h[j][0]; n++ {
			var right bool
			if n%2 == 0 {
				right = false
			} else {
				right = true
			}
			for k := 0; k < h[j][1]; k++ {
				if right == false {
					fmt.Printf("#")
					right = true
				} else {
					fmt.Printf(".")
					right = false
				}
			}

			fmt.Println("")
		}
		fmt.Println("")
	}

}



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



int main() {
ll N;
cin >> N;
ll num[200000];
for(int i = 0; i < N;i++) cin >> num[i];
ll ans = 0;
for(int i = 0; i < N;i++){
while(num[i] % 2 == 0){
num[i] /= 2;
ans++;
}
}
cout << ans << endl;
}


Measured memory_bytes: 384
#!/bin/bash

read a b

if [ $a = "H" ]; then
  x=0
else
  x=1
fi

if [ $b = "H" ]; then
  y=0
else
  y=1
fi

if [ $(($x ^ $y)) -eq 0 ]; then
  echo "H"
else
  echo "D"
fi



Measured memory_bytes: 376
#include<iostream>
#include<cstdio>
#include<cstring>
#define mod 1000000007
#define maxn 5000
using namespace std;
typedef long long ll;
int n;
struct edge {
	int from;
	int to;
	int next;
} E[maxn*2+5];
int head[maxn+5];
int esz=1;
void add_edge(int u,int v) {
	esz++;
	E[esz].from=u;
	E[esz].to=v;
	E[esz].next=head[u];
	head[u]=esz;
}

ll g[maxn+5];
ll dp[maxn+5][maxn+5];//dp[x][i] x子树里有i个点未匹配的方案数
int sz[maxn+5];
void dfs(int x,int fa) {
	static ll tmp[maxn+5];
	dp[x][1]=1;
	sz[x]=1;
	for(int i=head[x]; i; i=E[i].next) {
		int y=E[i].to;
		if(y!=fa) {
			dfs(y,x);
			for(int j=0; j<=sz[x]+sz[y]; j++) tmp[j]=0;
			for(int j=0; j<=sz[x]; j++) {
				for(int k=0; k<=sz[y]; k++) {
					tmp[j+k]+=(dp[x][j]*dp[y][k])%mod;
					tmp[j+k]%=mod;
				}
			}
			for(int j=0; j<=sz[x]+sz[y]; j++) dp[x][j]=tmp[j];
			sz[x]+=sz[y];
		}
	}

	for(int i=2; i<=sz[x]; i++) { //对于dp[x][0],(x,fa)这条边未覆盖,容斥系数*-1
		dp[x][0]-=dp[x][i]*g[i]%mod;
		dp[x][0]=(dp[x][0]+mod)%mod;
	}

}
int main() {
	int u,v;
	scanf("%d",&n);
	for(int i=1; i<n; i++) {
		scanf("%d %d",&u,&v);
		add_edge(u,v);
		add_edge(v,u);
	}
	g[0]=1;
	for(int i=1; i<=n; i++) {
		if(i%2==1) g[i]=0;
		else g[i]=g[i-2]*(i-1)%mod;
	}
	dfs(1,0);
	printf("%lld\n",(-dp[1][0]+mod)%mod);//x=1时不存在到父亲的边,多乘了-1 
}


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

#ifdef LOCAL
  #include <local.h>
#endif

#define EPS 1e-6
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define llinf 0x3f3f3f3f3f3f3f3f

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using namespace std; 

using ll = long long;
using ii = pair<int,int>;

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

  int n; cin >> n;
  vector<int> v(n);
  vector<ll> cnt(n + 1);

  for (auto &i : v) {
    cin >> i;
    cnt[i]++;
  }

  ll sum = 0;
  for (int i = 1; i <= n; ++i)
    if (cnt[i]) 
      sum += (cnt[i] * (cnt[i] - 1)) / 2;

  for (int i = 0; i < n; ++i)
    if (cnt[v[i]] >= 2) {
      ll x = (((cnt[v[i]] - 1) * (cnt[v[i]] - 2)) / 2);
      ll y = ((cnt[v[i]] * (cnt[v[i]] - 1)) / 2);
      cout << sum - y + x << ende;
    } else
      cout << sum << ende;

  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>
#include <cstring>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)


ll DP[3100][3100];

int main(){
    string S;
    string T;
    cin >> S;
    cin >> T;
    int LS = S.length();
    int TS = T.length();


    for(int i = 0; i < LS; i++){
        for(int j = 0; j < TS; j++){
    //while(!(i == LS && j == TS)){
            if(S[i] == T[j]){
                DP[i+1][j+1] = DP[i][j] + 1;
            }
            DP[i+1][j+1] = max(DP[i+1][j+1], DP[i+1][j]);
            DP[i+1][j+1] = max(DP[i+1][j+1], DP[i][j+1]);
    //}
        }
    }

    string ans = "";

    int i = LS;
    int j = TS;
    while(!(i == 0 && j == 0)){
        if(i-1 >= 0 && DP[i][j] == DP[i-1][j]){
            i--;
        }
        else if(j-1 >= 0 && DP[i][j] == DP[i][j-1]){
            j--;
        }
        else{
            i--, j--;
            ans = S[i] + ans;
        }
    }

    //for(int i = 0; i <= LS; i++){
    //    for(int j = 0; j <= TS; j++){
    //        printf("%d ", DP[i][j].len);
    //    }
    //    printf("\n");
    //}


    //cout << DP[LS][TS] << endl;
    cout << ans << endl;

    return 0;
}


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


signed main() {
int n;
cin>>n;
int a,b,l=0,ans=MOD;
for(int i=0;i<n;i++){
    cin>>a>>b;
    l+=a;
    if(a>b)ans=min(ans,b);
}
if(ans==MOD)cout<<0;
else cout<<l-ans;



return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
x = []
for i in range(n):
    x.append(list(map(int, input().split())))
x = list(map(list, zip(*x)))

val = [[0] * n for i in range(1 << len(x))]
for i in range(n):
    for j in range(1 << len(x)):
        for k in range(len(x)):
            val[j][i] += x[k][i] if (j >> k) & 1 == 1 else -x[k][i]

ans = 0
for j in range(1 << len(x)):
    val[j].sort()
    val[j].reverse()
    score = 0
    for i in range(m):
        score += val[j][i]
    ans = max([ans, score])

print(ans)


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,N;
  cin >> H >> N;
  int sum,a;
  for (int i = 0; i < N; i++){
    cin >> a;
    sum+=a;
  }
  if (sum>=H){
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[][] candy = new long[2][n];
		for(int i = 0; i < 2; i++) {
			for(int j = 0; j < n; j++) {
				candy[i][j] = sc.nextLong();
			}
		}
		long[][] sum = new long[2][n];
		sum[0][0] = candy[0][0];
		for(int i = 1; i < n; i++) {
			sum[0][i] = candy[0][i] + sum[0][i - 1];
		}
		sum[1][0] = sum[0][0] + candy[1][0];
		for(int i = 1; i < n; i++) {
			sum[1][i] = candy[1][i] + Math.max(sum[1][i - 1], sum[0][i]);
		}
		System.out.println(sum[1][n - 1]);

	}

}


Measured memory_bytes: 22608
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskC   {
public void solve(int testNumber, Scanner in, PrintWriter out) {
        int N = in.nextInt();
        int A[] = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = in.nextInt();
        }
        int a = A[0];
        for (int i=1; i<=N-1; i++) {
            a = gcd(a, A[i]);
        }
        out.println(a);

    }

public   static int gcd(int num1, int num2) {
        if(num2 == 0) {
            return num1;
        } else {
            return gcd(num2, num1 % num2);
        }
    }

}
}



Measured memory_bytes: 52100
#include <cstdio>


typedef long long int ll;

int main(){
    ll H,W;
    scanf("%lld%lld",&H,&W);

    if (H==1||W==1){
        puts("1");
        return 0;
    }

    ll col=W/2;
    ll c=col*H;

    ll last=W%2?(H/2+H%2):0;

    printf("%lld\n",c+last);



    return 0;
}  

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

int main() {
  //もちの数
  int N;
  cin >> N;
  //リストに格納
  vector<int> list(N);
  for(int i = 0; i < N; i++){
    cin >> list.at(i);
  }
  //リストを小さい順に
  sort(list.begin(),list.end());
  //並びを逆に
  reverse(list.begin(),list.end());
  
  //もしもちの大きさが一緒でないのならばカウント
  int sum = 1;
  for(int i = 1; i < N ; i ++){
    if(list.at(i - 1) > list.at(i)){
      sum += 1;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




int main()
{
    int N;
    cin >> N;
    vector<int> A(N-1);
    map<int, int> M;

    rep(i,N-1){
        cin >> A[i];
        M[A[i]]++;
    }

    rep2(i,1,N+1) cout << M[i] << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 13556
#include<string.h>
int main()
{
    char s[100];
    int d;
    gets(s);
    char m[]="Sunny";
    char n[]="Cloudy";
    char p[]="Rainy";
    d=strcmp(s,m);
    {
    if(d==0)  printf("Cloudy\n");
    }
    int e=strcmp(s,n);
    {
         if(e==0)  printf("Rainy\n");
    }
   int f=strcmp(s,p);
   {
         if(f==0) printf("Sunny\n");
    }
}


Measured memory_bytes: 128
#include<stdio.h>
 
int dp[50];
 
int fib(int n) {
    if (n == 0 || n == 1) return dp[n] = 1;
    if ( dp[n] != -1) return dp[n];
    return dp[n] = fib(n - 1) + fib(n - 2);
}
 
int main(void)
{
    int n, i;
    for (i = 0;i < 50; i++) dp[i] = -1;
 
    scanf("%d", &n);
    printf("%d\n", fib(n));
 
    return 0;
}



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

typedef long long ll;

int main () {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int N, A, B; cin >> N >> A >> B;
	ll C = A-B;
	vector<ll> v(N);
	for (int i = 0; i < N; i++)
		cin >> v[i];
	ll l = 0, r = 1e9;
	while (l < r) {
		ll mid = l + (r - l) / 2;
		// cout << l << ' ' << mid << ' ' << r << endl;
		ll tmp = 0;
		for (ll x : v) {
			ll tmp1 = x-B*mid;
			ll need0 = tmp1/C;
			ll need1 = (tmp1%C > 0 ? 1 : 0);
			tmp += (tmp1 > 0 ? need0 + need1 : 0);
		}
		// cout << ":: " << tmp << ' ' << mid << endl;
		if (tmp > mid)
			l = mid+1;
		else
			r = mid;
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int n; cin>>n; vector<PII> a(n); rep(i,n) cin>>a[i].first>>a[i].second;
	sort(RALL(a));
	cout<<a[0].first+a[0].second<<endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main {
    static int n;
    static long[] pref;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        n = sc.nextInt();
        long [] a = new long[n]; pref = new long[n + 1];
        for (int i = 0; i < n; i++) a[i] = sc.nextInt();
        for (int i = 1; i <= n; i++) pref[i] = pref[i - 1] + a[i - 1];
        // second cut
        long res = Long.MAX_VALUE;
        for (int i = 2; i <= n - 2; i++) {
            int lo = 1; int hi = i - 1;
            while (lo < hi) {
                int mid = (lo + hi) / 2;
                if (pref[mid] >= pref[i] / 2) {
                    hi = mid;
                } else {
                    lo = mid + 1;
                }
            }
            if (lo > 1 && Math.abs(pref[i] - pref[lo - 1] - pref[lo - 1]) < Math.abs(pref[i] - pref[lo] - pref[lo])) lo--;
            ArrayList<Long> ret = new ArrayList<>();
            ret.add(pref[lo]); ret.add(pref[i] - pref[lo]);
            lo = i + 1; hi = n - 1;
            while (lo < hi) {
                int mid = (lo + hi) / 2;
                if (pref[mid] >= pref[i] + (pref[n] - pref[i]) / 2) {
                    hi = mid;
                } else {
                    lo = mid + 1;
                }
            }
            if (lo > 1 && Math.abs(pref[lo - 1] - pref[i] - (pref[n] - pref[lo - 1])) < Math.abs(pref[lo] - pref[i] - (pref[n] - pref[lo]))) lo--;
            ret.add(pref[lo] - pref[i]); ret.add(pref[n] - pref[lo]);
            Collections.sort(ret);
            res = Math.min(res, ret.get(3) - ret.get(0));
        }
        out.println(res);
        out.close();
    }




    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 61320
using System;
using System.Collections.Generic;

namespace ALDS1_1_C{
    class Sample{
        static void Main(string[] args){
            List<int> nums = new List<int>();
            int row = int.Parse(Console.ReadLine());
            while(row>0){
                nums.Add(int.Parse(Console.ReadLine()));
                row--;
            }
            int count=0;
            foreach(int n in nums){
                if(Sosu(n)){
                    count++;
                }
            }
            Console.WriteLine(count);
        }

        static bool Sosu(int num){
            int x = num;
            if(x == 2){
                return true;
            } else if(x<2 || x%2==0){
                return false;
            }

            double dnum = Math.Sqrt(x);
            for(int i=3; i<=dnum; i+=2){
                if(x%i==0){
                    return false;
                }
            }
            return true;
        }
    }
}


Measured memory_bytes: 15972
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] input = new int[5];

		String str = sc.nextLine();
		String[] strs = str.split(" ");

		for (int i = 0; i < input.length; i++) {
			input[i] = Integer.parseInt(strs[i]);
		}

        int W = input[0];
        int H = input[1];
        int x = input[2];
        int y = input[3];
        int r = input[4];
        sc.close();

        int up = y + r;
        int ri = x + r;
        int le = x - r;
        int dw = y - r;

        if ( up <= H && ri <= W && le >= 0 && dw >= 0) {
        				System.out.println("Yes");
        }else {
        	System.out.println("No");
        }



	}

}


Measured memory_bytes: 26328
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


    class Program
    {
        static void Main(string[] args)
        {
            int line = int.Parse(Console.ReadLine());
            
            int AC = 0;
            int WA = 0;
            int TLE = 0;
            int RE = 0;
            
            for(int i = 0; i < line; i++){
                string line2 = Console.ReadLine();
                if(line2 == "AC"){
                    AC++;
                }else if(line2 == "WA"){
                    WA++;
                }else if(line2 == "TLE"){
                    TLE++;
                }else if(line2 == "RE"){
                    RE++;
                }
            }
            
            Console.WriteLine("AC x " + AC);
            Console.WriteLine("WA x " + WA);
            Console.WriteLine("TLE x " + TLE);
            Console.WriteLine("RE x " + RE);
        }
    }

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

int main() {
	std::string s;
	std::cin >> s;

	if (s.size() % 2 != 0) {
		std::cout << "No" << std::endl;
		return 0;
	}

	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] != 'h' || s[i + 1] != 'i') {
			std::cout << "No" << std::endl;
			return 0;
		}
	}

	std::cout << "Yes" << std::endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Os")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000007
#define M 998244353
using namespace std;
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
void vok()
{
    FAST
    FO
    FI
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}
int vis[int(1e7)];
int main()
{
    vok();
    int n;
    IN n;
    vector<int> v(n);
    loop(i,0,n)
    {
        IN v[i];
        vis[v[i]]++;
    }
    sort(v.begin(),v.end());
    int ans=0;
    loop(i,0,n)
    {
        bool flag=true;
        vis[v[i]]--;
        for(int j=1; j<=sqrt(v[i]); j++)
        {
            if(v[i]%j==0)
            {
                if(vis[j] || vis[v[i]/j])
                {
                    flag=false;
                    break;
                }
            }
        }
        vis[v[i]]++;
        if(flag)
        {
            ans++;
        }
    }
    OUT ans<<endl
    return 0;
}

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

int c[11][10], d[11][10][55][1 << 10];
int dx[]{ 1,0,0 }, dy[]{ 0,1,-1 };
struct st { int x, y, p, v, c; };
bool operator<(st a, st b) { return a.c > b.c; }
int main() {
	int w, h;
	while (scanf("%d%d", &w, &h), w) {
		int f, m, o; scanf("%d%d%d", &f, &m, &o);
		rep(i, h)rep(j, w)scanf("%d", &c[i + 1][j]);
		priority_queue<st>que;
		memset(d, 0x3f, sizeof(d));
		rep(i, w) {
			d[0][i][o][0] = 0; que.push({ 0,i,o,0,0 });
		}
		while (!que.empty()) {
			st p = que.top(); que.pop();
			if (d[p.x][p.y][p.p][p.v] != p.c)continue;
			if (p.p == 1)continue;
			rep(i, 3) {
				int nx = p.x + dx[i], ny = p.y + dy[i];
				if (!(nx <= h && 0 <= ny&&ny < w))continue;
				int a = min(m, ((c[nx][ny] > 0 && (!i || !(p.v >> ny & 1))) ? p.p - 1 + c[nx][ny] : p.p - 1));
				if (a <= 0)continue;
				int b = ((c[nx][ny] < 0 && (!i || !(p.v >> ny & 1))) ? p.c - c[nx][ny] : p.c);
				int e = ((i ? p.v : 0) | 1 << ny);
				if (d[nx][ny][a][e] > b) {
					d[nx][ny][a][e] = b; que.push({ nx,ny,a,e,b });
				}
			}
		}
		int Min = INF;
		rep(i, w)rep(j, m + 1)rep(k, 1 << w)Min = min(Min, d[h][i][j][k]);
		if (Min > f)puts("NA");
		else printf("%d\n", Min);
	}
}

Measured memory_bytes: 27576
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;
typedef vector <vi> vvi;
int K=1024,N=331,B[]={1,2,4,8,16,32,64,128,256,512},C[1024]={0};
vvi D(K,vi(N));
int init(){
	vi z(K);
	for (int i=0;i<N;i++)z[i]=0;
	for (int i=0;i<K;i++){
		D[i]=z;
		int tmp=i,tmp2=0,n=0;
		while (tmp){
			n+=tmp&1;
			tmp2++;
			tmp/=2;
		}
		C[i]=n;
		if(n==1)D[i][find(B,B+10,i)-B]=1;
		else{
			tmp = i;
			for (int j=0;j<tmp2;j++){
				if (tmp & 1){
					int dp = n*j,i2=i-B[j];
					for (int k=0;k<N-dp;k++)
						D[i][k+dp]+=D[i2][k];
				}
				tmp/=2;
			}
		}
	}
	return 0;
}
int main(){
	init();
	int n,s,i,x;
	while(1){
		cin>>n>>s;
		if(cin.eof())break;
		x=0;
		if(s<N)
			for(i=0;i<K;i++)
				if(C[i]==n)x+=D[i][s];
		cout<<x<<endl;
	}
}

Measured memory_bytes: 5232
#include<iostream>

using namespace std;

int combination(int a, int b)
{
	int N = a;
	int M = b;
	int ans = 1;
	for (int i = 0; i < b; i++)
	{
		ans *= N--;
	}
	for (int i = 0; i < b - 1; i++)
	{
		ans /= M--;
	}
	
	return ans;
}

int main(void)
{
	
	int N, M;
	cin >> N >> M;

	int ans = combination(N, 2) + combination(M, 2);

	cout << ans << endl;
	
	return 0;
	
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
from math import floor
sys.setrecursionlimit(100000)

N = int(input())
heap = [None] + [int(n) for n in input().split()]

for i, h in enumerate(heap[1:]):
    i += 1
    text = "node {}: key = {}, ".format(i, h)
    if i != 1:
        text += "parent key = {}, ".format(heap[floor(i/2)])
    if 2 * i <= N:
        text += "left key = {}, ".format(heap[2*i])
    if 2 * i + 1 <= N:
        text += "right key = {}, ".format(heap[2*i + 1])
    print(text)

Measured memory_bytes: 7716
#include<bits/stdc++.h>
using namespace std;
int ans;
int main(){
	string s;
	cin >> s;
	int a = s.length();
	for(int i=0;i<a/2;i++){
		if(s[i]!=s[a-i-1]){
			ans++;
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
MOD = 10**9+7
S = input()
l = len(S)
dp = [[0] * 13 for _ in range(l+1)]
dp[0][0] = 1
p = 1
for i in range(l):
  if(S[i] != '?'):
    n = int(S[i])
    for j in range(13):
      dp[i+1][(j*10+n)%13] += dp[i][j]
  else:
    for k in range(10):
      for j in range(13):
        dp[i+1][(j*10+k)%13] += dp[i][j]
  for j in range(13):
    dp[i+1][j] = dp[i+1][j]%MOD
  p = (p*10)%MOD    
print(dp[l][5])


Measured memory_bytes: 61916
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n=ir.nextInt();
		long ret=1;
		long mod=(long)1e9+7;
		for(int i=1;i<=n;i++){
			ret*=i;
			ret%=mod;
		}
		out.println(ret);
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}

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

int main()
{
    long int a,b,c,k;
    cin>>a>>b>>c>>k;
    
    int f=0;
    for(int i=1;i<=k;++i)
    {
        if(f==0&&b<=a)
        {
            b*=2;
            if(b>a)
            {
                f=1;
            }
        }
        else
        {
            c*=2;
        }
    }
    
    if(c>b&&b>a)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }

}

Measured memory_bytes: 3632
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		boolean c = false;
		for(int i = 0; i < s.length; i++) {
			if(s[i] == '7') {
				c = true;
				break;
			}
		}
		if(c) {
			System.out.println("Yes"); //C == true;
		}else{
			System.out.println("No"); //c == false の場合
		}
	}

	/*boolean true/false
			true = 正しい
			false = 間違ってる

			c = 7が入ってるかいなか
			7が入ってたら→OK			true
			7が入ってなかったら→だめ	false

			c == true いらない
			c ture ←trueが基準
			!c false
	*/
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
//{
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
};
//{
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb() fflush(stdout);
//}


int main() {
		make4(h1, m1, h2, m2);
		make(k);
		int a1 = h1*60+m1;
		int a2 = h2*60+m2;
		int ans = max(0, a2-a1-k);
		printf("%d\n", ans);

}


Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

const int INF = 2000000000;
const int sqrtN = 512;

class sqdiv{
	public:
		int N, K;
		vector<int> data;
		vector<bool> lazy_flag;
		vector<pair<int, int>> lazy_update;
		sqdiv(int n){ //バケットサイズの変更
			N = n;
			K = (N + sqrtN - 1) / sqrtN;
			data.assign(K * sqrtN, 0);
			lazy_flag.assign(K, false);
			lazy_update.assign(K, make_pair(0,0));
		}
		void eval(int k){
			if(lazy_flag[k]){
				lazy_flag[k] = false;
				for(int i = k * sqrtN; i < (k + 1) * sqrtN; i++){
					data[i] = data[i] + 1 == lazy_update[k].first ? lazy_update[k].second : INF;
				}
			}
		}
		void update(int x, int y, int a){
			rep(k,K){
				int l = k * sqrtN, r = (k + 1) * sqrtN;
				if(r <= x || y <= l) continue;
				if(x <= l && r <= y){
					if(lazy_flag[k]){
						lazy_update[k].second = lazy_update[k].second + 1 == a ? a : INF;
					}else{
						lazy_flag[k] = true;
						lazy_update[k] = make_pair(a,a);
					}
				}else{
					eval(k);
					for(int i = max(x, l); i < min(y, r); i++){
						data[i] = data[i] + 1 == a ? a : INF;
					}
				}
			}
		}
		int find(int a){
			int k = a / sqrtN;
			eval(k);
			return data[a];
		}
};

int main(){
	int n, k, t;
	cin >> n >> k >> t;

	sqdiv s(n);
	rep(i,t){
		int l, r, x;
		cin >> l >> r >> x;
		l--;
		s.update(l, r, x);
		//cout << s.data << endl;
	}

	int cnt = 0;
	rep(i,n){
		//cout << s.find(i) << ' ';
		if(s.find(i) == k) cnt++;
	}
	//cout << endl;
	cout << cnt << endl;

	/*
	 * 1 -2 3 -4
	 */
}



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

int main() {
	ll N;
	cin >> N;
	vector<ll> a(N), b(N);
	for(ll i=0; i<N; i++) cin >> a[i];
	for(ll i=0; i<N; i++) cin >> b[i];

	map<ll,ll> am,bm;
	for(ll i=0; i<N; i++){
		am[a[i]]++;
		bm[b[i]]++;
	}
	for(auto&& pr:am){
		if(pr.second + bm[pr.first]> N){
			cout << "No\n";
			return 0;
		}
	}

	vector<pair<ll,ll>> ans;
	priority_queue<array<ll,4>> q; //(a+bの要素数, aの要素数, bの要素数, 値)
	vector<ll> onlya, onlyb;
	for(auto&& pr:am){
		ll acount=am[pr.first];
		ll bcount=bm[pr.first];
		if(bcount){
			q.push({acount+bcount, acount, bcount, pr.first});
		}else{
			for(ll i=0; i<pr.second; i++)onlya.push_back(pr.first);
		}
	}
	for(auto&& pr:bm){
		if(am[pr.first])continue;
		for(ll i=0; i<pr.second; i++)onlyb.push_back(pr.first);
	}

	while((ll)q.size()>=2){
		array<ll,4> x=q.top();
		q.pop();
		array<ll,4> y=q.top();
		q.pop();
		x[0]--; y[0]--; x[1]--; y[2]--;
		ans.push_back({x[3], y[3]});
		if(x[1]==0 || x[2]==0){
			if(x[1]>0) for(ll i=0; i<x[1]; i++)onlya.push_back(x[3]);
			if(x[2]>0) for(ll i=0; i<x[2]; i++)onlyb.push_back(x[3]);
		}else{
			q.push(x);
		}
		if(y[1]==0 || y[2]==0){
			if(y[1]>0) for(ll i=0; i<y[1]; i++)onlya.push_back(y[3]);
			if(y[2]>0) for(ll i=0; i<y[2]; i++)onlyb.push_back(y[3]);
		}else{
			q.push(y);
		}
	}

	while(!q.empty()){
		array<ll,4> x=q.top();
		q.pop();
		for(ll i=0; i<x[1]; i++){
			ans.push_back({x[3], onlyb.back()});
			onlyb.pop_back();
		}
		for(ll i=0; i<x[2]; i++){
			ans.push_back({onlya.back(), x[3]});
			onlya.pop_back();
		}
	}

	for(ll i=0; i<(ll)onlya.size(); i++){
		ans.push_back({onlya[i], onlyb[i]});
	}

	sort(ans.begin(), ans.end());
	cout << "Yes\n";
	for(ll i=0; i<N; i++) cout << ans[i].second << " \n"[i==N-1];

	return 0;
}


Measured memory_bytes: 46560
#include<bits/stdc++.h>
#define ll long long
const int maxn=1e5+10;
using namespace std;

struct node
{
	ll a,b,c;
};
vector<node> v;
vector<ll> sumv;
ll cmp(ll a,ll b)
{
	return a>b;
}
int main()
{
	int n,m;
	ll ans=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		ll a,b,c;cin>>a>>b>>c;
		v.push_back({a,b,c});
	}
	for(int i=-1;i<=1;i+=2) 
	{
		for(int j=-1;j<=1;j+=2)
		{
			for(int k=-1;k<=1;k+=2)
			{
				sumv.clear();
				for(int s=0;s<v.size();s++)
				{
					sumv.push_back(v[s].a*i+v[s].b*j+v[s].c*k);
				}
				sort(sumv.begin(),sumv.end(),cmp);
				ll temp=0;
				for(int s=0;s<m;s++) temp+=sumv[s];
				ans=max(ans,temp);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            List<int> values = new List<int>();
            string str = Console.ReadLine(); //標準入力
            string[] str2 = str.Split(' ');
            int a = int.Parse(str2[0]);
            int b = int.Parse(str2[1]);

            char[,] masu = new char[a + 2, b + 2];

            for (int i = 0; i < a; i++)
            {
                str = Console.ReadLine();
                char[] c = str.Trim().ToCharArray();
                for (int i2 = 0; i2 < b; i2++)
                {
                    masu[i + 1, i2 + 1] = c[i2];
                }
            }


            for (int y = 1; y < a + 1; y++)
            {
                for (int x = 1; x < b + 1; x++)
                {
                    if (masu[y, x] == '#')
                    {
                        if (masu[y - 1, x] != '#' && masu[y + 1, x] != '#' && masu[y, x - 1] != '#' && masu[y, x + 1] != '#')
                        {
                            Console.WriteLine("No");
                            return;
                        }
                    }
                }
            }

            Console.WriteLine("Yes");
        }
    }
}


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

int main(){
    int N;
    cin >> N;

    long long ans=0;
    
    for(long long a = 1;a < N;a++){
        for(long long b = a;a*b < N;b++){
            if(a == b){
                ans++;
            }else{
                ans += 2;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3624