akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;

int main(void){
  int n; cin >> n;
  int d[n]; rep(i,n) cin >> d[i];
  long long ans = 1;
  if(d[0]==0) d[0]=1;
  else ans = 0;
  map<int,int>m;
  int l = 0;
  for(int i = 1; i<n; i++){
    m[d[i]]++;
    if(d[i]==0) ans=0;
    l = max(l,d[i]);
  }
  for(int i = 2; i<=l;i++){
    rep(j,m[i]){
      ans = (ans*m[i-1])%998244353;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 
 
 
	
int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	ll a,b;
	cin>>a>>b;
	
	if((a>=1 and a<=9) and (b>=1 and b<=9))
	{
		cout<<a*b<<'\n';
	}
	else{
		cout<<-1<<'\n';
	}
	
	
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int t = scanner.nextInt();

		if ((x - t) <= 0) {
			System.out.println(0);
		} else {
			System.out.println(x - t);
		}

	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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 FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



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

  int sum;
  int ans = 1000000000;

  FOR(i,-100,100){
    sum = 0;
    FOR(j,0,N-1){
      sum += (a[j]-i)*(a[j]-i);
    }
    chmin(ans,sum);
  }

  cout << ans << endl;

}



Measured memory_bytes: 256
tmp = input().split(' ')

k = int(tmp[0])
x = int(tmp[1])

a = k - 1
b = x - a
c = x + a

resulttmp = ''

if k == 1:
    resulttmp = str(x)
else:
    for i in range(b,c+1):
        resulttmp += str(i) + ' '

print(resulttmp)


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

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

ll dp[65][2];

int main(){
  int n; ll k;
  cin>>n>>k;
  vector<ll>a(n);
  rep(i,n)cin>>a[i];
  rep(i,65)rep(j,2)dp[i][j]=-1;
  dp[0][0]=0;
  for(int i=0; i<60; ++i){
    for(int j=0; j<2; ++j)if(dp[i][j]>=0){
      int d=60-1-i;
      ll msk=1LL<<d;
      int zero=0,one=0;
      rep(i,n){
        if(a[i]&msk)one++;
        else zero++;
      }
      int j2=j;
      if(k&msk)j2=1;
      chmax(dp[i+1][j2],dp[i][j]+one*msk);
      if((k&msk)||j==1){
        chmax(dp[i+1][j],dp[i][j]+zero*msk);
      }
    }
  }
  cout<<max(dp[60][0],dp[60][1])<<endl;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef long double ld;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX6 1001001//6
#define MAX7 10010010//7
#define SENTINEL 2000000000//9
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
#define CLR(mat) memset(mat, 0, sizeof(mat))
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
const int MOD = 1000000007;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

vector<bool>a(55555,1);
int main(){
   int n;cin>>n;
   auto er=[&](){
      VI res;
      for(int i=2;i*i<=55555;i++){
         int j=i+i;
         while(j<55555){
            a[j]=0;
            j+=i;
         }
      }
      rep(i,55555)if(i>=2 && a[i]==1 && i%10==1)res.emplace_back(i);
      return res;
      };
      VI res=er();
      rep(i,n)cout<<res[i]<<' ';
      cout<<endl;

   }


Measured memory_bytes: 3624
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define INF ((1LL<<62)-(1LL<<31))
#define min(p,q)((p)<(q)?(p):(q))


//辺の情報を個別に持つタイプ
typedef struct edge{ll s,g,a,b;double c;}E;
typedef struct graph{
	int vcnt,ecnt;
	E  e[200010];//適宜変える(ecnt)
}G;
G g;

int csort(const void*a,const void*b){
	double p=(*(E*)a).c,q=(*(E*)b).c;
	return p<q?-1:p>q?1:0;
}
void readgraph(){
	//適宜変える
	ll n,m;
	scanf("%lld%lld",&n,&m);
	rep(i,0,m){
		ll x,y,a,b;
		scanf("%lld%lld%lld%lld",&x,&y,&a,&b);
		g.e[2*i].s=x;
		g.e[2*i].g=y;
		g.e[2*i].a=a;
		g.e[2*i].b=b;
		g.e[2*i+1].s=y;
		g.e[2*i+1].g=x;
		g.e[2*i+1].a=a;
		g.e[2*i+1].b=b;
	}
	g.vcnt=n;
	g.ecnt=2*m;
}

//union-find
#define UFLIMIT (1<<17)
int unicnt[UFLIMIT+10];//正ならcnt、非正なら根のindex
void ufinit(int n){rep(i,0,n)unicnt[i]=1;}
int ufroot(int x){return unicnt[x]<=0?-(unicnt[x]=-ufroot(-unicnt[x])):x;}
int ufsame(int x,int y){return ufroot(x)==ufroot(y);}
void uni(int x,int y){if((x=ufroot(x))==(y=ufroot(y)))return;if(unicnt[x]<unicnt[y]){int t=x;x=y;y=t;}unicnt[x]+=unicnt[y];unicnt[y]=-x;}
#undef UFLIMIT

//クラスカル法
//最小全域木を構成する辺とそのコストの合計を求める
//union findが必要、事前にコストでソートが必要
//O(ElogE)
//*
double kurasukaru(){
	double ans=0;
	qsort(g.e,g.ecnt,sizeof(E),csort);
	ufinit(g.vcnt);
	rep(i,0,g.ecnt){
		if(!ufsame(g.e[i].s,g.e[i].g)){
			uni(g.e[i].s,g.e[i].g);
			ans+=g.e[i].c;
		}
	}
	return ans;
}
//*/


int main(){
	readgraph();
	double l=0,r=1e6;
	rep(_,0,100){
		double m=(l+r)/2;
		double sum=0;
		rep(i,0,g.ecnt)sum+=g.e[i].c=g.e[i].a-g.e[i].b*m;
//		rep(i,0,g.ecnt)printf("%d %d %d %d %f\n",g.e[i].s,g.e[i].g,g.e[i].a,g.e[i].b,g.e[i].c);printf("%f %f\n",m,sum-kurasukaru());puts("");
		if((sum/2-kurasukaru())<0)r=m;
		else l=m;
	}
	printf("%.9f\n",1/l);
}


Measured memory_bytes: 2924
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    for(int bits = 0; bits < 8; bits++){
        int num = s[0] - '0';
        vector<char> ops;
        for(int i = 0; i < 3; i++){
            if(bits >> i & 1){
                num += s[i + 1] - '0';
                ops.push_back('+');
            }else{
                num -= s[i + 1] - '0';
                ops.push_back('-');
            }
        }
        prints(num, bits);
        if(num == 7){
            cout << s[0];
            for(int i = 0; i < 3; i++){
                cout << ops[i] << s[i + 1];
            }
            cout << "=7\n";
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=700;

int n,m;
bool adj[MAXN][MAXN];

vector<pair<int,int> > missing;
bool done[MAXN];

vector<pair<int,int> > pairs;
int single;
bool can[MAXN+1];



void run() {
	scanf("%d%d",&n,&m);
	REP(i,m) { int a,b; scanf("%d%d",&a,&b); --a,--b; adj[a][b]=adj[b][a]=true; }

	pairs.clear(); single=0; REP(i,n) done[i]=false;
	missing.clear(); REP(i,n) FOR(j,i+1,n) if(!adj[i][j]) missing.PB(MP(i,j));
	REPSZ(i,missing) {
		int a=missing[i].first,b=missing[i].second;
		if(done[a]||done[b]) continue;
		vector<int> lst[2];	queue<pair<int,int> > q;
		q.push(MP(a,0)); q.push(MP(b,1)); done[a]=done[b]=true; lst[0].PB(a); lst[1].PB(b);
		while(!q.empty()) {
			int at=q.front().first,side=q.front().second; q.pop();
			REP(to,n) if(!done[to]&&!adj[at][to]) {
				done[to]=true; q.push(MP(to,1-side)); lst[1-side].PB(to);
			}
		}
		REP(side,2) REPSZ(j,lst[side]) FORSZ(k,j+1,lst[side]) { int u=lst[side][j],v=lst[side][k]; if(!adj[u][v]) { printf("-1\n"); return; } }
		REP(side,2) REPSZ(j,lst[side]) REP(k,n) if(!done[k]) assert(adj[lst[side][j]][k]);
		pairs.PB(MP(SZ(lst[0]),SZ(lst[1])));		
	}
	REP(i,n) if(!done[i]) ++single;

	REPE(j,n) can[j]=j<=single;
	REPSZ(i,pairs) for(int j=n;j>=0;--j) if(can[j]) { can[j]=false; can[j+pairs[i].first]=true,can[j+pairs[i].second]=true; }
	int mid=(n+1)/2;
	FORE(i,mid,n) if(can[i]) {
		int a=i,b=n-i;
		int ans=a*(a-1)/2+b*(b-1)/2;
		printf("%d\n",ans); return;
	}
	assert(false);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 2420
import java.io.*;
import java.util.Scanner;

public class Main{

	static int temp=0,a,b,c;
	public static void main(String args[])throws Exception{
		Scanner sc=new Scanner(System.in);
			 a= sc.nextInt();
			 b= sc.nextInt();
			 c= sc.nextInt();
		

		temp=a;
		a=b;
		b=temp;

		temp=a;
		a=c;
		c=temp;

		System.out.print(a+" "+b+" "+c);
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,x,da;
int a[225];
void dfs(int l,int r){
	if(l%r==0){
		da+=(l*2)-r;
		return ;
	}
	da+=(l-l%r)*2;
	dfs(r,l%r);
}
signed main(){
	cin>>n>>x;
	da=n;
	if(n-x>=x){
		dfs(n-x,x);
	}
	else dfs(x,n-x);
	cout<<da;
}

Measured memory_bytes: 3636
import sys,math
n = int(input())
ans = sys.maxsize
for i in reversed(range(1, math.sqrt(n).__int__() + 1)):
    if n % i == 0:
        cur = max(len(str(i)), len((str(n // i))))
        if ans > cur:
            ans = cur

if n == 1:
    print(1)
else:
    print(ans)


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

#define endl '\n'

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

	vector<string> v = {"a < b", "a > b", "a == b"};

	int a, b; cin >> a >> b;

	if(a == b) cout << v[2] << endl;
	else cout << v[a > b] << endl;

	return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<Int> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  
  int cnt = 1;
  Int ans = A[0];
  for(int i = 1; i < N; i++) {
    if (cnt == N-1) break;
    ans += A[i];
    cnt++;
    if (cnt == N-1) break;
    ans += A[i];
    cnt++;
    if (cnt == N-1) break;
  }
  cout << ans << endl;
}


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

namespace Exawizards
{
    class C
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split(' ').Select(z => int.Parse(z)).ToArray();
            int N = a[0], Q = a[1];
            string s = Console.ReadLine();

            List<char[]> list = new List<char[]>();
            for(int i = 0; i < Q; i++)
            {
                char[] b = Console.ReadLine().Split(' ').Select(z => char.Parse(z)).ToArray();
                list.Add(b);
            }
            list.Reverse();

            int indexL=0, indexR=N-1;
            bool[] danger = new bool[N];
            foreach (char[] b in list)
            {
                if (indexR < indexL) break;

                char t = b[0], d = b[1];
                if (d == 'R')
                {
                    if (s[indexR] == t) indexR--;
                    if (indexL - 1 >= 0 && s[indexL - 1] == t) indexL--;
                }
                else
                {
                    if (s[indexL] == t) indexL++;
                    if (indexR + 1 < N && s[indexR + 1] == t) indexR++;
                }
            }



            int r = Math.Max(indexR - indexL + 1, 0);
            Console.WriteLine(r);
        }

    }
}


Measured memory_bytes: 32284
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	int N,K; cin>>N>>K;
	vector<int> su(N);
	for(int i=0;i<K;i++){
		int d;cin>>d;
		for(int j=0;j<d;j++){
			int a; cin>>a;
			a--;
			su[a]++;
		}
	}
	int ans=0;
	for(int i=0;i<N;i++){
		if(su[i]==0)ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;

int main()
{
    string s;
    int n;
    int i, j = 0, k;
    int judge[26] = {0};
    
    cin >> s;
    
    n = s.length();
    
    if(n < 26) {
        for(i = 0; i < n; i++) {
            judge[int(s[i])-97]++;
        }
        
        while(judge[j] != 0) {
            j++;
        }
        
        cout << s << char(j+97) << endl;
        
    } else {
        
        i = 25;
        while((int(s[i]) < int(s[i-1])) && (i != 0)) {
            judge[int(s[i])-97]++;
            i--;
        }
        
        judge[int(s[i])-97]++;
        
        if(i == 0) {
            cout << "-1\n";
        } else {
            
            for(k = 0; k < i-1; k++) {
                cout << s[k];
            }
            
            j = int(s[i-1])-97;
            while(judge[j] == 0) {
                j++;
            }
            
            cout << char(j+97) << endl;
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
using namespace std;

void sharp(int w) {
	for (int i = 0; i < w + 2; i++) {
		cout << "#";
	}
	cout << endl;
}


int main() {
	int h, w;

	cin >> h >> w;
	
	vector<string>a(h);

	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}


	sharp(w);
	for (int i = 0; i< a.size(); i++) {
		cout << "#";
		cout << a[i];
		cout << "#" << endl;
	}
	sharp(w);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
    string s, ans;
    cin >> s;
    if(s == "Sunny") ans = "Cloudy";
    else if(s == "Cloudy") ans = "Rainy";
    else ans = "Sunny";
    cout << ans << endl;
    return 0;
}

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

typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=30;

int main(){
    
    ll A,B;cin>>A>>B;
    
    ll ans=0;
    
    if(A%4==1) ans=ans^A^(A+1)^(A+2);
    if(A%4==2) ans=ans^A^(A+1);
    if(A%4==3) ans=ans^A;
    
    if(B%4==0) ans=ans^B;
    if(B%4==1) ans=ans^(B-1)^B;
    if(B%4==2) ans=ans^(B-2)^(B-1)^B;
    
    cout<<ans<<endl;
    
}


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

int main() {
string s,t;
cin>>s>>t;
//cout<<t.substr(0,s.size())<<endl;
if(s.size()==t.size()-1&&s==t.substr(0,s.size()))
cout<<"Yes"<<endl;
else
{
  cout<<"No"<<endl;
}



}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  queue<char>A;queue<char>B;queue<char>C;
  string a,b,c; cin>>a>>b>>c;
  for(int i=0;i<a.size();i++)A.push(a.at(i));
  for(int i=0;i<b.size();i++)B.push(b.at(i));
  for(int i=0;i<c.size();i++)C.push(c.at(i));
  int count=0;
  for(int i=0;i<500;i++){
    if(count==0){
      if(A.empty()){cout<<"A"<<endl;return 0;}
      count=A.front()-97;
      A.pop();
    }
    else if(count==1){
      if(B.empty()){cout<<"B"<<endl;return 0;}
      count=B.front()-97;
      B.pop();
    }
    else{
      if(C.empty()){cout<<"C"<<endl;return 0;}
      count=C.front()-97;
      C.pop();
    }
  }
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<boost/dynamic_bitset.hpp>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

template <typename T> T mod_sub (T a, T b, T m) {
	return (a < b) ? m + a - b : (a - b) % m;
}

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

    u64 mod = pow(10, 9) + 7;
    if(N < 2) {
        cout << 0 << endl;
        return 0;
    }

    u64 U = 1;
    u64 A = 1;
    u64 B = 1;
    for(u64 i=0; i<N; i++) {
        U = (U * 10) % mod;
        A = (A * 9) % mod;
        B = (B * 8) % mod;
    }

    u64 ans = mod_sub((U + B) % mod, (2 * A) % mod, mod);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3668
#include <cstdio>
#include <algorithm>
using namespace std;
#define Maxn 100000
int a[Maxn+5];
int mn(int a,int b){
	return a<b?a:b;
}
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+1+n);
	int left=1,right=k;
	int ans=(1<<30);
	while(right<=n){
		ans=mn(ans,a[right]-a[left]);
		right++,left++;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}


signed main(){
  string str;
  cin>>str;
  int ans = 0;
  for(int i=0;i<(int)str.size()-1;i++){
    if(str[i] == 'A' && str[i+1] == 'C') ans = 1;
  }

  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

var s = bufio.NewScanner(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func main() {
	s.Split(bufio.ScanWords)

	n := 0
	if s.Scan() {
		n, _ = strconv.Atoi(s.Text())
	}

	T := make(map[string]int)
	for i := 0; s.Scan() && i < n; i++ {
		cmd := s.Text()
		if cmd[0] == 'f' {
			s.Scan()
			if _, ok := T[s.Text()]; ok {
				fmt.Fprintln(w, "yes")
				continue
			}
			fmt.Fprintln(w, "no")
			continue
		}
		s.Scan()
		T[s.Text()] = 0
	}

	w.Flush()
}



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

int main() {
	
    long long h,w;
    cin>>h>>w;
    char t;
    long long a[h][w],dp[h][w];
    dp[0][0]=1;
    for(long long i=0;i<h;i++){
        for(long long j=0;j<w;j++){
            cin>>t;
            if(t=='.'){
                a[i][j]=1;
            }else
                a[i][j]=0;
        }   
    }
    for(long long i=0;i<h;i++){
        for(long long j=0;j<w;j++){
            if(!(i||j)){
                continue;
            }
            if(!a[i][j]){
                dp[i][j]=0;
                continue;
            }if(!i){
                dp[i][j]=dp[i][j-1];
                continue;
            }if(!j){
                dp[i][j]=dp[i-1][j];
                continue;
            }
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
        }
    }cout<<dp[h-1][w-1];
}


Measured memory_bytes: 15872
//
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
//
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

//
// solution 
//
#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        N: usize,
        points: [(i64, i64, i64); N],
    }

    let mut min_h = points[0].2;
    let mut max_h = min_h + 200;

    for &(x, y, h) in points.iter() {
        min_h = max(min_h, h);
        max_h = min(max_h, h + max(100-x, x) + max(100-y, y)); 
    }

    for cx in 0..101 {
        for cy in 0..101 {
            'outer: for H in min_h..max_h+1 {
                for &(x, y, h) in points.iter() {
                    if h !=  max(H - (cx - x).abs() - (cy - y).abs(), 0) {
                        continue 'outer;
                    }
                }
                println!("{} {} {}", cx, cy, H);
            }
        }
    }

}

fn max(a: i64, b: i64) -> i64 {
    if a > b {
        a
    } else {
        b
    }
}

fn min(a: i64, b: i64) -> i64 {
    if a < b {
        a
    } else {
        b
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define ii insert
#define ld long double
#define ppb pop_back
#define nuenxfiu ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define TT int testcases;cin>>testcases;while(testcases--)
#define mk make_pair
#define MAX ((int)2e9+17)
#define N 200005
#define mod ((int)1e9+7)
#define MOD 1000003
//int fact[1000007]={0};
int fpow(int n, int k, int p = mod) {int r = 1; while(k > 0) {if (k & 1) r = r * n%p; n = n * n%p; k = k >> 1;} return r;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
using namespace std;





void solve()
{
	char c;
	cin>>c;
	
	if(c>='a' and c<='z')
	cout<<"a"<<endl;
	else
	cout<<"A"<<endl;
}
signed main()
{
    
	nuenxfiu
	//TT
	solve();
     return 0;
}

Measured memory_bytes: 3652
#ifdef xay5421
#define D(...) fprintf(stderr,__VA_ARGS__)
#else
#define D(...) ((void)0)
#define NDEBUG
#endif
#include<bits/stdc++.h>
#define PB push_back
#define SZ(x) ((int)(x).size())
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
typedef long long LL;
const int N=55,INF=0X3F3F3F3F;
int n,X,d,fa[N];
LL f[N*N*N];
struct data{
	LL w,p;
	int a;
	bool operator<(const data&k2)const{
		return w*k2.p<k2.w*p;
	}
}A[N];
int main(){
	scanf("%d%d%d",&n,&X,&d);
	int nn=n;
	scanf("%lld",&A[1].w),A[1].p=1,A[1].a=INF;
	rep(i,2,n){
		scanf("%lld",&A[i].w);
		A[i].p=1,A[i].a=d;
		scanf("%d",&fa[i]);
	}
	per(i,n,2){
		A[fa[i]].w+=A[i].w;
		A[fa[i]].p+=A[i].p;
	}
	per(i,n,1)if(A[i].w>X)swap(A[i],A[n--]);
	sort(A+1,A+1+n);
	memset(f,63,sizeof(f));
	f[0]=0;
	int allv=n*n*n;
	rep(i,1,n){
		int lim=min(A[i].a,nn);
		A[i].a-=lim;
		D("lim[%d]=%d\n",i,A[i].a);
		vector<int>num;
		int dd=lim;
		for(int j=1;j<=dd;j<<=1){
			num.PB(j);
			dd-=j;
		}
		if(dd)num.PB(dd);
		rep(k,0,SZ(num)-1){
			per(j,allv,A[i].p*num[k]){
				f[j]=min(f[j],f[j-A[i].p*num[k]]+A[i].w*num[k]);
			}
		}
	}
	LL ans=-1e18;
	auto tx=[&](LL sz){
		LL res=0;
		rep(i,1,n){
			LL m=min(sz/A[i].w,(LL)A[i].a);
			sz-=m*A[i].w;
			res+=m*A[i].p;
		}
		return res;
	};
	rep(i,0,allv){
		D("f[%d]=%lld\n",i,f[i]);
		if(f[i]<=X)ans=max(ans,i+tx(X-f[i]));
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 5048
// problem: "https://atcoder.jp/contests/abc151/tasks/abc151_d"

#include<bits/stdc++.h>
#define Pair pair<int,int>

using namespace std;

struct Node
{
    int i,j,n;

    Node(int i,int j,int n) : i(i),j(j),n(n) {}
};

int bfs(vector<vector<bool>>&M,int h,int w,int i,int j)
{

    queue<Node>Q;
    Q.push(Node(i,j,0));
    vector<vector<bool>>V(h,vector<bool>(w,0));
    V[i][j] = true;

    while(!Q.empty())
    {
        Node p = Q.front();
        Q.pop();

        if(p.i-1 >= 0 && p.j >= 0 && M[p.i-1][p.j] && !V[p.i-1][p.j])
        {
            V[p.i-1][p.j] = true;
            Q.push(Node(p.i-1,p.j,p.n+1));
        }

        if(p.i >= 0 && p.j-1 >= 0 && M[p.i][p.j-1] && !V[p.i][p.j-1])
        {
            V[p.i][p.j-1] = true;
            Q.push(Node(p.i,p.j-1,p.n+1));
        }

        if(p.i+1 < h && p.j >= 0 && M[p.i+1][p.j] && !V[p.i+1][p.j])
        {
            V[p.i+1][p.j] = true;
            Q.push(Node(p.i+1,p.j,p.n+1));
        }

        if(p.i >= 0 && p.j+1 < w && M[p.i][p.j+1] && !V[p.i][p.j+1])
        {
            V[p.i][p.j+1] = true;
            Q.push(Node(p.i,p.j+1,p.n+1));
        }

        if(Q.empty())
            return p.n;
    }

    return -1;
}

int MaxDist(vector<vector<bool>>&M,int h,int w)
{
    int Max = 0;
    int i,j;
    for(i=0;i!=h;i++)
    {
        for(j=0;j!=w;j++)
        {
            if(M[i][j])
            {
                Max = max(Max,bfs(M,h,w,i,j));      // define
            }
        }
    }

    return Max;
}

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

    int i,j;
    char c;
    vector<vector<bool>>M(h,vector<bool>(w,0));

    for(i=0;i!=h;i++)
    {
        for(j=0;j!=w;j++)
        {
            cin>>c;

            if(c == '.')
                M[i][j] = true;

            else
                M[i][j] = false;
        }
    }

    cout<<MaxDist(M,h,w);       // define

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
#define int long long
#define MAXN 100006
#define pii pair<int,int>
#define fi first
#define P 1000000007
#define se second
int n;
int A[MAXN] , B[MAXN];
pii a[MAXN << 1]; int k = 0;
signed main() {
	cin >> n;
	for( int i = 1 ; i <= n ; ++ i ) scanf("%lld",&A[i]) , a[++ k] = make_pair( A[i] , 0 );
	sort( A + 1 , A + 1 + n );
	for( int i = 1 ; i <= n ; ++ i ) scanf("%lld",&B[i]) , a[++ k] = make_pair( B[i] , 1 );
	sort( a + 1 , a + 1 + 2 * n );
	int lef = 0 , res = 1;
	for( int i = 1 ; i <= 2 * n ; ++ i ) {
		if( a[i].se == 0 ) {
			if( lef < 0 ) res *= -lef , res %= P;
			++ lef;
		} else {
			if( lef > 0 ) res *= lef , res %= P;
			-- lef;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)


// ------------debug用------------
#define FALSE cout<<"false"<<endl;
#define TRUE cout<<"true"<<endl;
// ------------debug用------------


// ------------計算用------------
#define ALL(x) (x).begin(),(x).end()
#define FOR(x) for(ll i = 0;i < x;++i)
// ------------計算用------------


// ------------出力用------------
#define PRINT(x) cout<<x<<endl;
// ------------出力用------------


using namespace std;
typedef long long ll;

int main(){
  string s;
  cin>>s;
  int a[100];
  for(int i = 0;i < 100;i++)a[i] = 0;
  for(int i = 0;i < 4;i++)a[(int)s[i] - (int)'A']++;
  int two = 0;
  for(int i = 0;i < 100;i++){
    if(a[i] == 2)two++;
  }
  if(two == 2)cout<<"Yes"<<endl; else cout<<"No"<<endl;
  return 0;
}


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

int main() {
string s;
  int k;
  cin>>k>>s;
  if(s.size()<=k){cout<<s<<endl;}
  else{
  vector<char> vec(s.size());
  for(int i=0;i<s.size();i++){
  vec.at(i)=s.at(i);
  }
    for(int j=0;j<k;j++){cout<<vec.at(j);}
    cout<<"..."<<endl;
  }
}

Measured memory_bytes: 3632
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n = gli();
    ll a = gli();
    ll b = gli();
    ll h = n/(a+b);
    n -= h*(a+b);
    n = MIN(n, a);
    cout << h*a + n << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++) 
#define rrep(i,n) for(int i = 1; i <= (int)(n); i++) 
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

//const ll mod = 1000000007;
//const ll INF = mod * mod;
//const double pi = 3.14159265358979;

int main() {
    int n,m;
    cin >> n >> m;
    vector<vc> a(n,vc(n)),b(m,vc(m));
    rep(i,n) {
        rep(j,n) {
            cin >> a[i][j];
        }
    }
    rep(i,m) {
        rep(j,m) {
            cin >> b[i][j];
        }
    }
    bool ok = false;
    rep(i,n) {
        rep(j,n) {
            if(i + m - 1 >= n || j + m - 1 >= n) continue;
            bool sub_ok = true;
            rep(k,m) {
                rep(l,m) {
                    if(a[i+k][j+l] != b[k][l]) sub_ok = false;
                }
            }
            if(sub_ok) ok = true;
        }
    }
    if(ok) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        out_of_loop: while (true) {
            int a = Integer.parseInt(sc.next());
            String op = sc.next();
            int b = Integer.parseInt(sc.next());

            int ans = 0;

            switch (op) {
            case "+":
                ans = a + b;
                break;
            case "-":
                ans = a - b;
                break;
            case "*":
                ans = a * b;
                break;
            case "/":
                ans = a / b;
                break;
            case "?":
                break out_of_loop;
            }

            System.out.println(ans);
        }

        sc.close();
    }
}


Measured memory_bytes: 26224
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a,b;
    cin >> a >> b;
    string ab = a+b;
    int x = stoi(ab);
    string ans = "Yes";
    double num = sqrt(x);
    x = num;
    if(num-x>0){
        ans = "No";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
int main()
{
    int m, f, r;
    while(true){
        std::cin >> m >> f >> r;
        if(m == -1 && f == -1 && r == -1){
            break;
        }
        // not take midterm or final exam
        else if(m == -1 || f == -1){
            std::cout << "F" << endl;
        }
        // take both midterm and final exam
        else {
            if(m + f >= 80){
                std::cout << "A" << endl;
            }
            else if (m + f >= 65){
                std::cout << "B" << endl;
            }
            else if (m + f >= 50){
                std::cout << "C" << endl;
            }
            else if (m + f >= 30){
                if(r >= 50){
                    std::cout << "C" << endl;
                }
                else {
                    std::cout << "D" << endl;
                }
            }
            else {
                std::cout << "F" << endl;
            }
        }
    }
    return 0;
}



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

h = [int(x) for x in input().split()]

dp = [0]*N
dp[1] = abs(h[0]-h[1])

for i in range(2,N):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])

Measured memory_bytes: 83732
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define M 1000000007
using namespace std;
const int inf=4e18;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n,i,o=inf;cin>>n;
	for(i=1;i*i<=n;i++)
		if(n%i==0)
			o=min(i+n/i-2,o);
	cout<<o<<endl;
}

Measured memory_bytes: 256
/*
srt: 2017年04月23日 11時16分20秒
《乌衣巷》刘禹锡
朱雀桥边野草花，乌衣巷口夕阳斜。
旧时王谢堂前燕，飞入寻常百姓家。
end: 2017年04月23日 11時26分40秒
*/

#include<cstdio>
inline void read(int&r)
{
	register char c;r=0;
	do c=getchar();while(c<'0'||c>'9');
	do r=r*10+c-'0',c=getchar();while(c>='0'&&c<='9');
}

int a[500001],b[500001],d[500001];
int main()
{
	int n,i;read(n),read(a[0]);
	for(i=1;i<=n;i++)read(d[i]),a[i]=d[i]>=a[i-1]<<1?a[i-1]:a[i-1]>d[i]?a[i-1]-d[i]:d[i]-a[i-1];
	if(a[n])
	{
		read(n);
		while(n--)puts("YES");
		return 0;
	}
	b[n]=1;
	for(i=n;i;i--)
		b[i-1]=d[i]>=b[i]<<1?b[i]:b[i]+d[i];

	read(n);
	while(n--)read(i),puts(a[i-1]>=b[i]?"YES":"NO");
	return 0;
}

Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
#define FASTIO  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define vi vector<ll>
#define all(a) (a).begin(), (a).end()
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define tr(it, a)   for(auto it=a.begin();it!=a.end();it++)
#define pb push_back
#define endl  "\n"
const ll MAX=1000+3;
const ll mod=1e9+7;
char v[MAX][MAX];
ll n,m;
ll fun()
{
    ll dp[MAX][MAX],i,j,c=1;
    for(i=0;i<n;i++)
    {
        if(v[i][0]=='.' && c==1)
            dp[i][0]=1;
        else
        {
           dp[i][0]=0;
           c=0;
        }
    }
    c=1;
    for(i=0;i<m;i++)
    {
        if(v[0][i]=='.' && c==1)
            dp[0][i]=1;
        else
        {
           dp[0][i]=0;
           c=0;
        }
    }
    for(i=1;i<n;i++)
    {
        for(j=1;j<m;j++)
        {
            if(v[i][j]=='#')
                dp[i][j]=0;
            else
                dp[i][j]=((dp[i-1][j] %mod)+(dp[i][j-1] %mod))%mod;
        }
    }
    /*for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
        cout<<dp[i][j]<<" ";
        }
    cout<<endl;
    }*/
    return dp[n-1][m-1];


}

int main()
{
   FASTIO
   int t=1;
  // cin>>t;
   while(t--)
  {
       // ll n,k;
        cin>>n>>m;
       rep(i,0,n)
       {
           rep(j,0,m)
           {
               cin>>v[i][j];
           }
       }
        ll ans=fun();
        cout<<ans;

   }
 return 0;
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,B,C;
    cin >> A >> B >> C;
    if(A == B && B == C){
        print("Yes");
    }else{
        print("No");
    }
    
}

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


int main() {
	ll n,mem,a,b;
	vector<int> array;
	vector<int> end;
	vector<int> p;
	vector<int> q;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		array.push_back(i);
	}
	for (int i = 0; i < n; i++) {
		cin >> mem;
		p.push_back(mem);
	}
	for (int i = 0; i < n; i++) {
		cin >> mem;
		q.push_back(mem);
	}
	ll mema = 1, memb = 1;
	do {
		if (array == p)a = mema;
		if (array == q)b = memb;
		mema++;
		memb++;

	} while (next_permutation(array.begin(), array.end()));
	cout << abs(a - b) << endl;
	return 0;
}

Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    print(N*N*N);
    
}

Measured memory_bytes: 256
using System;

namespace question2
{
    class Program
    {
        static void Main(string[] args)
        {
            var p = new Program();
            p.Run();
        }

        void Run(){
            var n = int.Parse(Console.ReadLine());
            var total = 0;
            var max = 0;

            for(int i=0;i<n;i++){
                var pi = int.Parse(Console.ReadLine());
                total+=pi;
                max = Math.Max(max, pi);
            }

            Console.WriteLine($"{total-max/2}");
        }
    }
}


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

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

  int x;
  for (int i = 0; i < N && H > 0; i++) {
    cin >> x;
    H = H - x;
  }
  if (H <= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define maxn 100010
#define ll long long

struct node{int x,y,next;};
node e[4*maxn];
int first[2*maxn];
void buildroad(int x,int y)
{
	static int len=0;
	e[++len]=(node){x,y,first[x]};
	first[x]=len;
}
int n,m=0;
bool v[maxn*2],vis[maxn*2];
void dfs_getm(int x)
{
	if(x>maxn-10)m++;v[x]=true;
	for(int i=first[x];i;i=e[i].next)
	if(!v[e[i].y])dfs_getm(e[i].y);
}
ll ans=0;
void dfs_collectans(int x)
{
	if(x<=maxn-10)
	{
		int tot=0;
		for(int i=first[x];i;i=e[i].next)
		tot++;
		ans+=(ll)m-tot;
	}
	vis[x]=true;
	for(int i=first[x];i;i=e[i].next)
	if(!vis[e[i].y])dfs_collectans(e[i].y);
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		buildroad(x,y+maxn-10);
		buildroad(y+maxn-10,x);
	}
	for(int i=1;i<=maxn-10;i++)
	{
		if(first[i]==0||v[i])continue;
		m=0;
		dfs_getm(i);
		dfs_collectans(i);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 5248
#include <stdio.h>

int digits(long int n)
{
  int cnt=0;
  while(n!=0)
  {
    n/=10;
    cnt++;
  }
  
  if(cnt%2==0)
       return 0;
  
  else
     return 1;
}

int main()
{
  long int n;
  scanf("%d",&n);
  long int i,cnt=0;
  for(i=1;i<=n;++i)
  {
    if(digits(i))
       cnt++;
  }
  
  printf("%ld",cnt);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N;
    cin >> N;
    vec A(N);
    ll sum = 0;
    rep(i, N) cin >> A[i], sum += A[i];
    sum /= 2;

    vec ans(N, 0);
    rep(i, N) if (i % 2) sum -= A[i];
    ans[0] = sum;
    rep(i, N - 1) ans[i + 1] = A[i] - ans[i];
    rep(i, N) print(ans[i] * 2);

    return 0;
}

Measured memory_bytes: 2944
N = int(input())
h = list(map(int, input().split()))
x = [0] * N
x[1] = x[0] + abs(h[1] - h[0])
for i in range(2, N):
    x[i] = min(x[i - 1] + abs(h[i] - h[i - 1]),
               x[i - 2] + abs(h[i] - h[i - 2]))
print(x[N-1])


Measured memory_bytes: 13980
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll=long long;
#define MOD  1000000007

ll n;
int dp[100010];

int main(int argc, char const *argv[]) {
  std::cin >> n;

  if(n<=8){
    std::cout << n%6 + n/6 << '\n';
    return 0;
  }

  for(int i=0; i<=n; i++) dp[i]=i;
  dp[1]=1,dp[6]=1,dp[9]=1;

  int six,nine;

  for(int i=6; i<=n; i++){
    six=6;
    nine=9;
    while(i>=six){
      dp[i]=min(dp[i],dp[i-six]+1);
      six*=6;
    }

    while(i>=nine){
      dp[i]=min(dp[i],dp[i-nine]+1);
      nine*=9;
    }
  }

  std::cout << dp[n] << '\n';



  return 0;
}


Measured memory_bytes: 640
# AGC004a
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    a, b, c = map(int, input().split())

    if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
        print(0)
        exit(0)
    print(min(a*b, b*c, c*a))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

using namespace std;
#define int long long
using ll = long long;
const int MX = 1e6;
const ll inf = 1e13;
const int mod = 1e9+7;
signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int ma = a[0];
    int ans = 0;
    rep(i,n) {
        if(ma>a[i]) {
            ans +=ma-a[i];
        }
        ma = max(a[i],ma);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4836
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxi = 100005;
ll cost[105][maxi];
ll val[105],w[105];

int main()
{
	ll n,W;cin>>n>>W;

	for(int i =0;i<=n;i++)
		for(int j=0;j<=100001;j++)
				cost[i][j]=100000000000L;


	cost[0][0]=0;

	for(int i=1;i<=n;i++)
	cin>>w[i]>>val[i];

	for(int i=0;i<n;i++)
	for(int j=0;j<=100001;j++)
	{
		cost[i+1][j]=min(cost[i+1][j],cost[i][j]);
		if(cost[i][j]+w[i+1]<=W)cost[i+1][j+val[i+1]]=min(cost[i+1][j+val[i+1]],cost[i][j]+w[i+1]);
	}
	ll ans = 0;
	for(int i =0;i<=100001;i++)
	if(cost[n][i]<=W)ans=i;

	cout<<ans<<endl;

}


Measured memory_bytes: 82568
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

template <class T>
void cout_vec2(const vector<vector<T>> &vec){
  rep(i,vec.size()){
    rep(j,vec[i].size()){
      cout<<vec[i][j]<<' ';
    }
    cout<<endl;
  }
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int n,k;
vector<vector<int>> g(2010);
vector<int> dist(2010,-1);
vector<bool> used(2010,false);

void dfs(int v,int d){
  if(used[v]) return ;
  dist[v]=d;
  used[v]=true;
  for(auto itr:g[v]) dfs(itr,d+1);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n>>k;
  vector<int> a(n-1),b(n-1);
  rep(i,n-1){
    cin>>a[i]>>b[i];
    a[i]--,b[i]--;
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  int ans=1e9;
  if(k%2==0){
    rep(i,n){
      int cnt=0;
      rep(j,n) used[j]=false;
      dfs(i,0);
      rep(j,n){
        if(dist[j]>k/2) cnt++;
      }
      ans=min(ans,cnt);
    }
  }else{
    rep(i,n-1){
      int u=a[i],v=b[i];
      queue<int> que;
      que.push(u);
      que.push(v);
      rep(i,n) dist[i]=-1;
      dist[u]=0,dist[v]=0;
      while(!que.empty()){
        int now=que.front();
        que.pop();
        for(auto itr:g[now]){
          if(dist[itr]==-1){
            dist[itr]=dist[now]+1;
            que.push(itr);
          }
        }
      }
      int cnt=0;
      rep(i,n){
        if(dist[i]>(k-1)/2) cnt++;
      }
      ans=min(ans,cnt);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define rrep(i,s,e) for(int (i) = (s);(i) >= (e);(i)--)
int a[100005];

int gcd(int a,int b){
  return b==0?a:gcd(b,a%b);
}

signed main() {
  int n,x;cin>>n>>x;
  rep(i,0,n-1)cin>>a[i];
  a[n] = x;
  sort(a,a+n+1);
  rrep(i,n,1)a[i]-=a[i-1];
  
  int ans = a[1];

  rep(i,2,n) ans = gcd(ans,a[i]);
  cout << ans << endl;

  
}


Measured memory_bytes: 1024
N, M = list(map(int,input().split()))
K_and_Ss = []
for i in range(M):
    data = list(map(int,input().split()))
    K_and_Ss.append(data)
Ps = list(map(int,input().split()))

flag = False
x = 2**N
sum = 0
for i in range(x):
    for j in range(M): #j番目の電球がついているかを判定
        count = 0
        if flag:
            flag = False
            break
        for k in range(len(K_and_Ss[j])-1):
            if (i >> (K_and_Ss[j][k+1]-1) & 1) == 1:
                count += 1
            if k ==len(K_and_Ss[j])-2 and count % 2 == Ps[j]:
                flag = False
                if j == M-1:
                    sum += 1
            if k ==len(K_and_Ss[j])-2 and count % 2 != Ps[j] and j != M-1:
                flag = True
print(sum)


Measured memory_bytes: 74024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i;
    string s;
    cin>>s;
    if(s[s.size()-1]=='s')
    {
        cout<<s;
        cout<<"es"<<endl;
    }
    else
    {
        cout<<s;
        cout<<'s'<<endl;
    }

    return 0;
}


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

#define F first
#define S second
#define pb push_back
#define mp make_pair

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

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

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

	ll a,b,c,k;

	cin >> a >> b >> c >> k;

	if(a < b && a < c)
		cout << "Yes\n";
	else
	{
		ll cnt = 0;
		while(b <= a)
		{
			b *= 2;
			cnt++;
		}


		while(c <= b)
		{
			c*=2;
			cnt++;
		}



		if(cnt <= k)
			cout << "Yes\n";
		else
			cout << "No\n";		
	}

	
}

Measured memory_bytes: 3652