akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 100500;

int n, ans, a[N];

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;
	
	cin >> n;

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

	for (int i = 1; i <= n; i++) {
		int j = i;
		while (j < n && a[j] <= a[j + 1])
			j++;
		int k = i;
		while (k < n && a[k] >= a[k + 1])
			k++;
		i = max(j, k);
		ans++;
	}

	cout << ans;
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int euclid(int large, int small){
  int r1 = large % small;
  if(r1==0)
    return small;
  return euclid(small,r1);
}

void main(){
  int k, r;
  long long int sum=0;
  scanf("%d",&k);
  
  for(int a=1; a<=k; a++){
    for(int b=a; b<=k; b++){
      for(int c=b; c<=k; c++){
        if(a==b && b==c && c==a)
          sum += a;
        else if(a==b || b==c || c==a){
          r = euclid(c,b);
          if(a<r)
            sum += 3*euclid(r,a);
          else
            sum += 3*euclid(a,r);
        }
        else{
          r = euclid(c,b);
          if(a<r)
            sum += 6*euclid(r,a);
          else
            sum += 6*euclid(a,r);
        }
//        printf("%d %d %d %lld\n",a, b, c, sum);
      }
    }
  }
  
  printf("%lld",sum);
}

Measured memory_bytes: 1724
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

//////////////////////////



ll n,m,q;
#define Q 100
ll a[Q],b[Q],c[Q],d[Q];
ll ans=0;
void dfs(vector<ll>v){
    ll vs=v.size();
    if(vs==n){
        ll sum=0;
        rep(i,0,q-1){
            if(v[b[i]]-v[a[i]]==c[i])sum+=d[i];
        }
        chmax(ans,sum);
        return;
    }
    ll last=1;
    if(vs>=1)last=v[vs-1];
    rep(i,last,m){
        v.pb(i);
        dfs(v);
        v.pop_back();
    }
}

int main(){fastio
    
    cin>>n>>m>>q;
    rep(i,0,q-1){
        cin>>a[i]>>b[i]>>c[i]>>d[i];a[i]--;b[i]--;
    }
    
    vector<ll>v;
    dfs(v);
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 3668
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

res = 0
for i in range(N):
    res += min(a[i], b[i])
    if a[i] < b[i]:
        t = min(b[i] - a[i], a[i + 1])
        a[i + 1] -= t
        res += t

print(res)

Measured memory_bytes: 18476
N, K = map(int, input().split())
tmp = 0
for x in range(1, N + 1):
    a = 0
    n = 0
    while K > x:
        x *= 2
        n += 1
    p = 1 / N * (1 / 2 ** n)
    tmp += p
print(tmp)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;


#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef vector<int> VI;
const constexpr ll MOD = 1e9+7;
vector<pair<int, int> > vp;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};

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


//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
ll N, H;
string s;
ll a[100010], b[100010];
bool used[101][101];
vector<string> field;
int main(void) {
    ll H, W;
    cin >> H >> W;
    cin.ignore();
    for(int i=0; i<H; ++i){
        string str;
        getline(cin, str);
        field.push_back(str);
    }
    

    for(int i=0; i<H; ++i){
        bool ok = false;
        for(int j=0; j<W; ++j){
            if(field[i][j]=='#') ok = true;
            if(ok) break;
            if(j==W-1){
                for(int k=0; k<W; ++k) used[i][k]=true;
            }
        }
    }
    
    for(int i=0; i<W; ++i){
        bool ok = false;
        for(int j=0; j<H; ++j){
            if(field[j][i]=='#') ok = true;
            if(ok) break;
            if(j==H-1){
                for(int k=0; k<H; ++k) used[k][i]=true;
            }
        }
    }
    REP(i, H){
        bool aaa=false;
        REP(j, W){
            if(!used[i][j]){
                aaa=true;
                cout << field[i][j];
            }
        }
        if(aaa) cout << endl;
    }
    
    
	return 0;
}

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

typedef long long ll;
ll a, b, c = 1, gcd;

ll f(ll p, ll q) {
	if (q == 0) return p;
	return f(q, p % q);
}

int main()
{
	ll i;
	cin >> a >> b;
	gcd = f(a, b);
	for (i = 2; i * i <= gcd; i++) {
		if (gcd % i == 0) c++;
		while (gcd % i == 0) gcd /= i;
	}
	if (gcd > 1) c++;
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int h, w, n;
  string S, T, U;
  cin >> h >> w >> T >> U;
  
  for (int j = 0; j < w; j++) {
    if (T.at(j) == '.') {
      n = 0;
      for (int k = j - 1; k < j + 2; k++) {
        if (k >= 0 && k < w) {
          if (T.at(k) == '#')
            n++;
          if (h > 1) {
            if (U.at(k) == '#')
            n++;
          }
        }
      }
      cout << n;
    }
    
    else
      cout << '#';
  }
  cout << endl;
  
  if (h > 1) {
  for (int i = 1; i < h; i++) {
    S = T;
    T = U;
    if (i < h - 1)
      cin >> U;
    for (int j = 0; j < w; j++) {
 	   if (T.at(j) == '.') {
    	  n = 0;
      	for (int k = j - 1; k < j + 2; k++) {
      	  if (k >= 0 && k < w) {
      	    if (S.at(k) == '#')
        	    n++;
          	if (T.at(k) == '#')
           	    n++;
        	if (i < h - 1) {
              if (U.at(k) == '#')
            	  n++;
         	 }
     	   }
 	     }
 	     cout << n;
  	  }
    
    else
      cout << '#';
  }
  cout << endl;
  }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll x,y; cin >> x >> y;
  if(x%y==0) cout << -1 << endl;
  else cout << x << endl;
}



Measured memory_bytes: 764
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		String S = in.next();
		int x=0;
		int judge=0;
		for(int i=0;i<N;i++){
			if(S.charAt(i)=='I')x++;
			else x--;
			if(judge<x)judge=x;
		}
		System.out.println(judge);
		in.close();
	}
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n; std::cin >> n;
  set<int> s;
  rep(i, n) {
    int a; std::cin >> a;
    if (s.count(a)) s.erase(a);
    else s.insert(a);
  }
  std::cout << s.size() << "\n";
}


Measured memory_bytes: 4992
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;


class Main {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();

        if(a==b && b==c){
            out.println("No");

        }else{
            if(a==b || b==c || c==a ){
                out.println("Yes");

            }else {
                out.println("No");
            }
        }

        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}

Measured memory_bytes: 21204
s = input()
t = input()

ct = 0
k = 0
for i in t:
    f = s.find(i, k)
    if f < 0:
        ct += 1
        f = s.find(i)
        if f == -1:
            print(-1)
            break
        else:
            k = f+1
    else:
        k = f+1
else:
    print(ct*len(s)+k)


Measured memory_bytes: 3316
import fractions
A,B,C,D = (int(x) for x in input().split())
c = 0
d = 0
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
M = lcm(C,D)
c = B//C - A//C
if A%C == 0:
  c = c+1
d = B//D - A//D
if A%D == 0:
  d = d+1
m = B//M - A//M
if A%M == 0:
  m = m+1
print(B-A+1-(c+d-m))

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

int main(){
    int n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    int num=0,foreigner=0;
    for(int i=0;i<n;i++){
        if(s[i]=='a' && num<a+b){
            puts("Yes");
            ++num;
        }else if(s[i]=='b' && num<a+b && foreigner<b){
            puts("Yes");
            ++num;
        }else puts("No");
        if(s[i]=='b') ++foreigner;
    }
}

Measured memory_bytes: 896
#include<iostream>
#include<cmath>
#include<cstring>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;

int main() {
    int n;
    cin >> n;
    int x[n], y[n];
    rep(i, n) cin >> x[i];
    rep(i, n) cin >> y[i];
    double D1 = 0, D2 = 0, D3 = 0, D4 = 0;
    
    rep(i, n) {
        int tl = 0;
        tl = fabs(x[i] - y[i]);
        D1 += tl;
        D2 += 1.0 * tl * tl;
        D3 += 1.0 * tl * tl * tl;
    }
    D2 = sqrt(D2);
    D3 = pow(D3, 1 / 3.0);
    rep(i, n) {
        D4 = D4 < fabs(x[i] - y[i]) ? fabs(x[i] - y[i]):D4;
    }

    printf("%lf\n%lf\n%lf\n%lf\n", D1, D2, D3, D4);

    return 0;
}


Measured memory_bytes: 3344
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long n, k, ans;

	cin >> n >> k;
	ans = min(n, abs(k - n));

	ans = min(ans % k, k - (ans % k));

	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
 long long int t;
  cin>>t;
 long long int a[t];
long long int mpp[1000009];
memset(mpp,0,sizeof(mpp));
 
 long long int sum=0;
  for(int i=0;i<t;i++)
  {
    cin>>a[i];
    mpp[a[i]]++;
    sum+=a[i];
  }
 long long int q;
  cin>>q;
  for(int i=0;i<q;i++)
  {
  long long  int aa,b;
    cin>>aa>>b;
    sum=sum-(mpp[aa]*aa)+mpp[aa]*b;
    cout<<sum<<"\n";
    mpp[b]+=mpp[aa];
    mpp[aa]=0;
       

     
  }
}
  
  
  


Measured memory_bytes: 12220
n=int(input())
a=list(map(int,input().split()))
import math
s=[0]*(n+1)#累積和法
a.insert(0,0)
for i in range(1,n+1):
    s[i]=s[i-1]+a[i]
from collections import Counter
data=Counter(s)
def combination_cout(n,r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))#組み合わせ計算
ans=[]
for i in data.values():
    if 2<=i:#同じ文字が2個以上ある時の文字数
        ans.append(i)
total=0
for i in ans:
    total+=combination_cout(i,2)
print(total)
        


Measured memory_bytes: 41812
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001000
#define mod 1000000007
#define pi 3.1415926535
using namespace std;

int main(void){
    string s,t;
    cin>>s>>t;
    ll a,b;
    cin>>a>>b;
    string u;
    cin>>u;
    if(s == u){
        a--;
    }
    else{
        b--;
    }
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 256
import math

n, k = map(int, input().split())

xyc = []
for _ in range(n):
    x, y, c = map(int, input().split())
    xyc.append((x, y, c))

if k == 1:
    print(0)
    exit()


def get_intersecs(x0, y0, r0, x1, y1, r1):
    # circle 1: (x0, y0), radius r0
    # circle 2: (x1, y1), radius r1

    d=math.sqrt((x1-x0)**2 + (y1-y0)**2)

    # non intersecting
    if d > r0 + r1 :
        return []
    # One circle within other
    if d < abs(r0-r1):
        return []
    # coincident circles
    if d == 0 and r0 == r1:
        return []
    else:
        a=(r0**2-r1**2+d**2)/(2*d)
        if r0 < a:
            return []
        h=math.sqrt(r0**2-a**2)
        x2=x0+a*(x1-x0)/d
        y2=y0+a*(y1-y0)/d
        x3=x2+h*(y1-y0)/d
        y3=y2-h*(x1-x0)/d

        x4=x2-h*(y1-y0)/d
        y4=y2+h*(x1-x0)/d

        return [(x3, y3), (x4, y4)]


def calc(x1, y1, x2, y2, c2):
    return c2 * math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)


def count(x, y, t):
    cnt = 0
    for i in range(n):
        xi, yi, ci = xyc[i]
        if calc(x, y, xi, yi, ci) < t + 0.0000001:
            cnt += 1
            if cnt >= k:
                return cnt
    return cnt


def check(t):
    # 円の中心
    for i in range(n):
        x, y, _ = xyc[i]
        if count(x, y, t) >= k:
            return True
    # 円の交点
    for i in range(n - 1):
        for j in range(i + 1, n):
            x1, y1, c1 = xyc[i]
            x2, y2, c2 = xyc[j]
            intersecs = get_intersecs(x1, y1, t/c1, x2, y2, t/c2)
            for (x, y) in intersecs:
                # print(x, y)
                if count(x, y, t) >= k:
                    return True
    return False


low = 0
high = 10 ** 7
for _ in range(100):
    mid = (high + low) / 2
    if check(mid):
        high = mid
    else:
        low = mid
print((high + low) / 2)


Measured memory_bytes: 76328
def main():
    import sys
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    while True:
        C -= B
        if C <= 0:
            print("Yes")
            break
        A -= D
        if A <= 0:
            print("No")
            break

if __name__ == '__main__':
    main()

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;

const string YES = "YES";
const string NO = "NO";

void solve()
{
  vector<int> a(3);
  cin>>a[0]>>a[1]>>a[2];
  int five=0;
  int seven=0;
  for (int i=0; i<3; i++) {
    if (a[i]==5) five++;
    if (a[i]==7) seven++;
  }
  if (five==2&&seven==1) cout << YES << endl;
  else cout << NO << endl;
}

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


Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    s1=int(s[0:2])
    s2=int(s[2:4])
    flg0,flg1=0,0
    if s1==0 or s1>12:
        flg0=1
    if s2==0 or s2>12:
        flg1=1
    if flg0==1 and flg1==1:
        print('NA')
    elif flg0==0 and flg1==0:
        print('AMBIGUOUS')
    elif flg0==0 and flg1==1:
        print('MMYY')
    elif flg0==1 and flg1==0:
        print('YYMM')
    
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
n,k=map(int,input().split())
a=list(map(int,input().split()))
i=0

res=[1,a[0]]
d=set(res)

end=0
ans=0

while True:
    if i>n-1:
      break
    
    i=a[i]-1
    t=a[i]
    if t not in d:
        res.append(t)
        d.add(t)
    else:
        end=i
        break
l=len(res)
s=res.index(a[end])
r=l-s
if k<l:
    print(res[k])
else:
    k-=s
    ans=k%r + s
    print(res[ans])

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

int main(){
    string s;
    cin>>s;
    rep(i,3){
        if(s[i]=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<ll, ll> > vpl;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  string s;
  string cdfs = "CODEFESTIVAL2016";
  cin >> s;
  int ans = 0;
  rep(i,16){
    if(s[i] != cdfs[i]) ans++;
  }
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>

#define NMAX 100000

int as[NMAX];

int main() {
  int N, M, a, b;
  std::cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    std::cin >> a >> b;
    if (as[b] < a)
      as[b] = a;
  }
  int count = 0;
  int maxa = 0;
  for (int i = N; i > 0; --i) {
    if (maxa == i) {
      ++count;
      maxa = as[i];
    } else if (maxa < as[i])
      maxa = as[i];
  }
  if (maxa)
    ++count;
  std::cout << count << std::endl;
  return 0;
}

Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
m2, m4 = 0, 0
for i in range(N):
    if A[i] % 4 == 0:
        m4 += 1
    elif A[i] % 2 == 0:
        m2 += 1
m0 = N - m2 - m4
length = N - m2
msg = "No"
if (m4 >= m0) or (length % 2 == 1 and m2 == 0 and m4 >= m0 - 1):
    msg = "Yes"
print(msg)


Measured memory_bytes: 14252
while True:   
    res = 0 
    data = [int(x) for x in input().split()]
    if data == [0,0]:
        break
    for i in range(1,data[0]+1):
        for j in range(i+1,data[0]+1):
            for k in range(j+1,data[0]+1):
                if (i + j + k) == data[1]:
                    res = res + 1
    print(res)


Measured memory_bytes: 5604
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int n,tmp = 0,tmp2 = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0;i < n;i++) cin >> a[i];
    sort(a.begin(),a.end(),greater<int>());
    tmp = a[0];
    for(int i = 1;i < n;i++){
        tmp2 += a[i];
    }
    if(tmp2 > tmp) cout <<"Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



def main():
    n, k = map(int, input().split())
    ls = list(map(int, input().split()))

    ls.sort(reverse=True)
    ans = sum(ls[:k])
    print(ans)

if __name__ == "__main__": main()


Measured memory_bytes: 4084
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LEN 100000
#define min(a,b) (((a)<(b)) ? (a) : (b))

typedef struct{
  char name[100];
  int t;
}p;

p q[LEN];
int head=0,tail=0,n;

void enqueue(p x){
  int next=(tail+1)%LEN;

  if(head==next){
    printf("Queue overflow!\n");
    exit(2);
  }

  q[tail]=x;
  tail=next;
}
p dequeue(void){
  p x;

  if(head==tail){
    printf("Queue is empty!\n");
    exit(3);
  }

  x=q[head];
  head=(head+1)%LEN;
  return x;
}

int main(){
  int i,qn,c,time=0;
  p u;

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

  for(i=1;i<=n;i++){
    scanf("%s%d",q[i].name,&q[i].t);
    enqueue(q[i]);
  }

  while(head!=tail){
    u=dequeue();                  //処理するものを取り出す
        c=min(qn,u.t);                //ｑｍｓと処理するものを比較
    u.t-=c;                      //処理するものを比較して値が小さかったほうで引く
    time+=c;                     //経過時間を計算
    if(u.t>0) enqueue(u);        //処理が終了していないものはもう１度、キューを行う
    else{
      printf("%s %d\n",u.name,time);
    }
  }


  return 0;
}


Measured memory_bytes: 11888
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
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(){
  ll N,K,ans=0,mx=1;
  bool CAN=false;
  cin>>N>>K;
  ll A[N];
  REP(i,N) cin>>A[i];
  
  ll t=A[0];
  REP(i,N){
    t=gcd(t,A[i]);
    chmax(mx,A[i]);
  }
  
  if(mx>=K){
    if(t==1 || K%t==0) CAN=true;
  }
  
  if(CAN) co("POSSIBLE");
  else co("IMPOSSIBLE");
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include <string>

using namespace std;


int main() {

	int A, B, C;
	int count=0;
	int sum=0;


	cin >> A >> B >> C;
		while (sum + A <= B && C > count) {
			count++;
			sum += A;
		}
	
	cout << count << endl;

	return 0;
}



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

#define mp make_pair
#define pb push_back

#define ll long long

const int MOD = 1e9+7;

int n,m;
const int N=1e5+5;
vector<int> adj[N];
int dp[N];
int maxans=0;
vector<int> vis(N,0);

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

    int n,m;
    cin>>n>>m;
    int arr[n][m];
    char a;
    int dp[n][m];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a;
            arr[i][j]=((a=='.')?1:0);
            dp[i][j]=0;
        }
    }

    dp[0][0]=1;


    queue<pair<int,int>> bfs;
    bfs.push({1,0});
    bfs.push({0,1});
    map<pair<int,int>,int> vis;
    while(!bfs.empty())
    {
        pair<int,int> now = bfs.front();
        bfs.pop();
        if(vis[now])
            continue;
        vis[now]=1;
        int x=now.first;
        int y=now.second;
        int temp=0;
        if(x-1>=0)
            temp+=dp[x-1][y];
        if(y-1>=0)
            temp+=dp[x][y-1];
        if(arr[x][y])
            dp[x][y]=temp;
        else
            dp[x][y]=0;
        dp[x][y]%=MOD;
        if(x+1<n)
            bfs.push({x+1,y});
        if(y+1<m)
            bfs.push({x,y+1});
        //cout<<x<<" "<<y<<" "<<dp[x][y]<<"\n";

    }

    cout<<dp[n-1][m-1];
    return 0;
}

Measured memory_bytes: 73856
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include <limits>
#include <iomanip>
#include <cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n-1;i >= 0;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second

const long double pi = 3.141592653589793;
const int mod = 1e9 + 7;

int N, X[200222], Y[200222];
char D[200222];
int ans = INT_MAX;
vector<int> B;

void collide_along_X_OR_Y() {
  sort(B.begin(), B.end(), [](const int &i, const int &j) {
    if(Y[i] != Y[j]) return Y[i] < Y[j];
    return X[i] < X[j];
  });

  int bs = B.size();
  for(int i = 0;i < bs-1;i++) {
    if(Y[B[i]] == Y[B[i+1]] && D[B[i]] == 'R' && D[B[i+1]] == 'L') {
      ans = min(ans, (X[B[i+1]]-X[B[i]])*5);
    }
  }

  swap(X, Y);
  sort(B.begin(), B.end(), [](const int &i, const int &j) {
    if(Y[i] != Y[j]) return Y[i] < Y[j];
    return X[i] < X[j];
  });

  for(int i = 0;i < bs-1;i++) {
    if(Y[B[i]] == Y[B[i+1]] && D[B[i]] == 'U' && D[B[i+1]] == 'D') {
      ans = min(ans, (X[B[i+1]]-X[B[i]])*5);
    }
  }
  swap(X, Y);
}

unordered_map<char, char> ma;

void rotate_by_90() {
  rep(i, N) {
    swap(X[i], Y[i]);
    X[i] = -X[i];

    D[i] = ma[D[i]];
  }
}

void collide_UP_LEFT() {
  sort(B.begin(), B.end(), [](const int &i, const int &j) {
    int d1 = Y[i]-X[i];
    int d2 = Y[j]-X[j];
    if(d1 != d2) return d1 < d2;
    return X[i] < X[j];
  });
  int bs = B.size();
  for(int i = 0;i < bs-1;i++) {
    if((Y[B[i]] - X[B[i]]) == (Y[B[i+1]] - X[B[i+1]])) {
      if(D[B[i]] == 'U' && D[B[i+1]] == 'L') {
        ans = min(ans, (X[B[i+1]]-X[B[i]])*10);
      }
    }
  }
}

int main() {

 // freopen("input.in","r",stdin);
 // freopen("output.out","w",stdout);

 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

 ma['D'] = 'R';
 ma['R'] = 'U';
 ma['U'] = 'L';
 ma['L'] = 'D';

 cin >> N;
 rep(i, N) {cin>>X[i]>>Y[i]>>D[i];B.pb(i);}

 collide_along_X_OR_Y();

 rep(i, 4) {
   rotate_by_90();
   collide_UP_LEFT();
 }

 if(ans == INT_MAX) cout << "SAFE" << endl;
 else cout << ans << endl;

 return 0;
}


Measured memory_bytes: 5960
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fsp(x) fixed << setprecision(x)
#define xout cerr
const ll inf = LLONG_MAX;
const long double pi = acosl(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n, m, d;
	cin >> n >> m >> d;

	long double ans = (long double)(n - d) * (!!d + 1) * (m - 1) / (n * n);
	cout << fsp(7) << ans << endl;
}


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

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

int main() {
  int N, nans, ans=-1;
  cin >> N;
  vector<int> A(N), left(N), right(N);
  for (int i=0; i<N; i++) cin >> A.at(i);
  left.at(0) = A.at(0);
  right.at(N-1) = A.at(N-1);
  for (int i=1; i<N; i++) {
    left.at(i) = gcd(left.at(i-1), A.at(i));
    right.at(N-i-1) = gcd(right.at(N-i), A.at(N-i-1));
  }
  for (int i=0; i<N; i++) {
    if (i==0) nans = right.at(1);
    else if (i==N-1) nans = left.at(N-2);
    else nans = gcd(left.at(i-1), right.at(i+1));
    ans = max(ans, nans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
int main(){

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

    vector<pair<long long, long long> > dp(k + 1, make_pair(0, 0));
    dp[k].first = 2;
    dp[k].second = 2; 

    for(int i = k - 1; i >= 0; i--){
        if(dp[i + 1].first % a[i] == 0) dp[i] = dp[i + 1];
        else dp[i].first = (dp[i + 1].first - dp[i + 1].first % a[i]) + a[i];
        dp[i].second = dp[i + 1].second - dp[i + 1].second % a[i];
        dp[i].second += a[i] - 1;
        
    }

    /*for(int i = 0; i <= k; i++){
        cout << dp[i].first << " " << dp[i].second << endl;
    }*/

    if(dp[0].first > dp[0].second) cout << -1 << endl;
    else cout << dp[0].first << " " << dp[0].second << endl;
    return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
	cout << fixed << setprecision(10);
	string s;
	cin >> s;
	string t = "keyence";
	int cnt = 0;
	int itr = 0;
	int pre = 0;
	rep(i,int(s.size())){
		for(int j = i - 1; j < int(s.size()); j++){
			string sub = "";
			rep(k,s.size()){
				if(k >= i && k <= j) continue;
				else sub += s[k];
			}
			if(sub == t){
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}

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

using namespace std;

int main(){
	int n; cin>>n;
	int sum = 0;
	int x = n;
	while(x){
		sum += x%10;
		x /= 10;
	}
	if(n%sum == 0) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = []
a.append(list(map(int,input().split())))
a.append(list(map(int,input().split())))
cnt = 0
cnt_max =0

for i in range(n):
    y = 0
    cnt = 0
    
    for x in range(n):
        cnt += a[y][x]
        if(x==i):
            y = 1
            cnt += a[y][x]
        
    if(cnt>cnt_max):
        cnt_max = cnt
print(cnt_max)

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

#define ul unsigned long long
#define ll long long

int main()
{
  ul n;
  cin>>n;
  ul ct=0,cds;
  for (ul i=1;i<=n;i+=2) {
    cds=0;
    for (ul j=1;j<=i;j++)
      cds+=i%j==0;
    ct+=cds==8;
  }

  cout<<ct<<endl;

  return 0;
}




Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);


ll n, k;
vector<ll> a;

void solve() {
//    bitset<64> a(1e12);
//    bitset<64> b(6);
//    bitset<64> c(3);
//    cout << a << endl;
//    cout << b << endl;
//    while (b.to_ullong() > 0) {
//        b = (b >> 1);
//        cout << b << endl;
//        cout << (b.to_ullong() & 1) << endl;
//    }

    map<ll, ll> mp;
    ll bits[48];
    fill(bits, bits + 48, 0);

    rep(i, n) {
        bitset<48> bitset1(a[i]);
        int idx = 0;
        while (bitset1.to_ullong() > 0) {
            mp[idx] += (bitset1.to_ullong() & 1);
            bits[idx] += (bitset1.to_ullong() & 1);
            bitset1 = (bitset1 >> 1);

            idx++;
        }
    }

//    vector<pair<ll, ll> > v(mp.begin(), mp.end());
//    // sort from bigger.
//    sort(v.begin(), v.end(),
//         [](pair<ll, ll> a, pair<ll, ll> b) {
//             return ll(pow(2, a.first)) * (n - a.second) > ll(pow(2, b.first)) * (n - b.second);
//         });

    ll ans = 0;
    repr(i, 48) {
        if (bits[i] <= n / 2) {
            ll temp = ll(pow(2, i));
            if (ans + temp <= k) ans += temp;
        }
    }
    ll ans_f = 0;
    rep(i, n) {
        ans_f += ans^a[i];
    }
    cout << ans_f << endl;
}

int main() {
    cin >> n >> k;
    a.resize(n);
    rep(i, n) cin >> a[i];
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>

using namespace std;

int main(void)
{
    //入力部
    int N; //帰宅経路数
    int T; //使用可能時間数
    cin>>N>>T;
    vector<int> c(N); //経路コスト
    vector<int> t(N); //経路使用時間
    for(int i=0; i<N; i++)
    {
        cin>>c[i]>>t[i];
    }

    //最低値探索
    int cmin = 1000000; //使用最低コスト,初期値は最高値以上としとく
    for(int i=0; i<N; i++)
    {
        //時間が帰宅可能か確認
        if(t[i]<=T)
        {
            if(cmin>c[i]) 
            {
                cmin = c[i];
            }
        }
    }

    //表示部
    if(cmin>100000) cout<<"TLE"<<endl;
    else cout<<cmin<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define arraySize(A) (sizeof(A)/sizeof(A[0]))
#define FOR(i,n) for(int i=0;i<n;i++)
#define LOOP(n) for(int __loopCountNum=0;__loopCountNum<n;__loopCountNum++)


using namespace std;

int qsort_int_compare_descend(const void *a,const void *b){
    return *(int*)b - *(int*)a;
}
void descendOrder(int size,int *array){//ko-jun
    qsort(array,size,sizeof(int),qsort_int_compare_descend);
}

long mod = 1000000007;

int main(){
    int N,M;
    int A[1000],B[1000];
    
    cin >> N >> M;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<M;i++){
        cin >> B[i];
    }
    
    descendOrder(N, A);
    descendOrder(M, B);
    
    for(int i=1;i<N;i++){
        if(A[i-1]==A[i]){
            cout << 0;
            return 0;
        }
    }
    for(int i=1;i<M;i++){
        if(B[i-1]==B[i]){
            cout << 0;
            return 0;
        }
    }
    long count = 1;
    long a = 0,b = 0;
    for(long i=N*M;i>0;i--){
        int p,q;
        if(a==N){ p=0; }
        else{ p=A[a]; }
        if(b==M){ q=0; }
        else{ q=B[b]; }
        
        if(i==p && i==q){
            a++;
            b++;
        }
        else if(p==i){
            count *= b;
            count %= mod;
            a++;
        }
        else if(q==i){
            count *= a;
            count %= mod;
            b++;
        }
        else{
            long k = a*b - (N*M - i);
            count *= k;
            count %= mod;
        }
    }
    cout << count;
    
    return 0;
}


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

using namespace std;

int main(){
int A[3][3],C[3][3];
for (int i = 0; i < 3; ++i)
{
  for (int j = 0; j < 3; ++j)
  {
    cin>> C[i][j];
    A[i][j] = 1;
  }
}
int N; cin >> N;
 int b[N];
 for (int k = 0; k < N; ++k) {
  cin >> b[k];
  for (int i = 0; i < 3; ++i)
  {
    for (int j = 0; j < 3; ++j)
    {
      if(b[k] == C[i][j]) A[i][j] = 0;
    }
  }
 }
int flag = 1;
 for (int i = 0; i < 3; ++i)
 {
  if (A[i][0]+A[i][1] + A[i][2]==0) flag = 0;
  if (A[0][i]+A[1][i] + A[2][i]==0) flag = 0;
 }
 if (A[0][0]+A[1][1] + A[2][2]==0) flag = 0;
 if (A[2][0]+A[1][1] + A[0][2]==0) flag = 0;

 if (flag ==0) cout << "Yes";
 else cout << "No";
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n, p[10];
    int i, max=0, maxi, sum=0;

    scanf("%d", &n);

    for(i=0; i<n; i++)
        scanf("%d", &p[i]);

    for(i=0; i<n; i++){
        if(p[i] > max){
            max = p[i];
            maxi = i;
        }
    }

    p[maxi] /= 2;

    for(i=0; i<n; i++)
        sum += p[i];
    
    printf("%d\n", sum);

    return 0;
}

Measured memory_bytes: 128
S=input()
T=input()
ans=0

for i in range(len(S)-len(T)+1):
  temp=S[i:i+len(T)]
  cnt=0
  for j in range(len(T)):
    if T[j]==temp[j]:
      cnt+=1
  else:
    ans=max(ans,cnt)
print(len(T)-ans)

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

int main()
{
    string s, t;
    cin >> s >> t;

    int sn = s.size(), tn = t.size();
    int ans = tn;
    int temp;
    rep (i, sn - tn + 1)
    {
        temp = tn;
        rep (j, tn)
            if (s[i + j] == t[j])
                temp--;
        ans = min(temp, ans);
    }

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


Measured memory_bytes: 3628
// ?????¬???????????¬??????

#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

// ????????¢?´¢ (kD ??¨???2 ?¬???????????????§???)
struct Node {
    int loc, l, r;
};

struct Point {
    int id, x, y;
};

Node T[500010];
Point P[500010];
int np = 0, NIL = -1;

// [l, r) ??????????????????????????????????§???????????????????????????????????????????
int make(int l, int r, int depth=0) {
    if(l >= r) return NIL;
    int mid = (l + r) / 2, t = np++;
    if(depth % 2 == 0) {
        sort(P+l, P+r, [](const Point &a, const Point &b){return a.x < b.x;});
    }
    else {
        sort(P+l, P+r, [](const Point &a, const Point &b){return a.y < b.y;});
    }
    T[t].loc = mid;
    T[t].l = make(l, mid,   depth+1);
    T[t].r = make(mid+1, r, depth+1);
    return t;
}

// ?????? (sx, ty)????????? (tx, sy) ???????????¢???????????????????????????
// v ??? kD-tree ??????????????????????????????
// find(root, sx, tx, sy, ty, ans) ?????????????????????
void find(int v, int sx, int tx, int sy, int ty, vector<int> &ans, int depth=0) {
    int x = P[T[v].loc].x, y = P[T[v].loc].y;
    if(sx <= x && x <= tx && sy <= y && y <= ty) {
        // ans.push_back(Point{x, y});
        ans.push_back(P[T[v].loc].id);
    }

    if(depth % 2 == 0) {
        if(T[v].l != NIL && sx <= x) find(T[v].l, sx, tx, sy, ty, ans, depth+1);
        if(T[v].r != NIL && x <= tx) find(T[v].r, sx, tx, sy, ty, ans, depth+1);
    }
    else {
        if(T[v].l != NIL && sy <= y) find(T[v].l, sx, tx, sy, ty, ans, depth+1);
        if(T[v].r != NIL && y <= ty) find(T[v].r, sx, tx, sy, ty, ans, depth+1);
    }
}

// kD-tree end

int N, Q;

signed main() {
    scanf("%lld", &N);
    rep(i,0,N) {
        int x, y; scanf("%lld%lld", &x, &y);
        P[i] = Point{i, x, y};
        // T[i].l = T[i].r = T[i].p = NIL;
    }
    int root = make(0, N);

    scanf("%lld", &Q);
    rep(i,0,Q) {
        vector<int> ans;
        int sx, tx, sy, ty;
        scanf("%lld%lld%lld%lld", &sx, &tx, &sy, &ty);
        find(root, sx, tx, sy, ty, ans);
        sort(ans.begin(), ans.end());

        for(auto x : ans) printf("%lld\n", x);
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 25468
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll a,b,c,k; cin >> a >> b >> c >> k;
    if (k&1) cout << (b-a);
    else cout << -(b-a);
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(b-a==c-b){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    long long k;
    cin >> k;
    long long i=1;
    long long x, t=0;
    long long f;
    bool flg=true;
    bool runrun;
    while(flg){
        //cout << i << endl;
        x=i;
        runrun=true;
        f=1;
        while(x>10){
            long long p=x%10;
            x/=10;
            long long q=x%10;
            if((p-q<=1)&&(q-p<=1)){

            }else{
                runrun=false;
                if(p<q){
                    i=x*f*10 + (q-1)*f - 1;
                    //i+=(q-p-1)*f-1;
                }else{
                    i=(x+1)*f*10 - 1;
                    //i+=(10-p)*f-1;
                }
                break;
            }
            f*=10;
        }
        if(runrun)t++;
        if(t==k){
            cout << i << endl;
            return 0;
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

void cout_vec(vector<int> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    string S, T;
    cin >> S >> T;

    vector<int> accS((int)S.size()+1, 0);
    vector<int> accT((int)T.size()+1, 0);
    for(int i=0; i<(int) accS.size()-1; i++){
        if(S[i]=='B'){
            accS[i+1]=accS[i]+2;
        }else{
            accS[i+1]=accS[i]+1;
        }
    }
    for(int i=0; i<(int) accT.size()-1; i++){
        if(T[i]=='B'){
            accT[i+1]=accT[i]+2;
        }else{
            accT[i+1]=accT[i]+1;
        }
    }

    //cout_vec(accS);
    //cout_vec(accT);

    int q;
    cin >> q;
    for(int i=0; i<q; i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--;
        c--;

        if((accS[b]-accS[a])%3==(accT[d]-accT[c])%3){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

Measured memory_bytes: 1664