akhauriyash/Code-Regression huggingface dataset:
s = input()
t = input()

d = {}
use = set()
for si,ti in zip(s,t):
    if(si in d):
        if(ti != d[si]):
            print('No')
            exit()
    else:
        if(ti in use):
            print('No')
            exit()
        d[si] = ti
        use.add(ti)

print('Yes')

Measured memory_bytes: 74080
#include <iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    
    int a[100001];
    for (int i=0; i< N; i++) {
        cin >> a[i+1];
    }
    
    int b[100001];
    for (int i=0; i< N; i++) {
        b[i+1] =0;
    }
    
    bool can =false;
    int num =0;
    int sp =1;
    int next =1;
    
    for (int i=0; i< N; i++) {
        b[sp] += b[sp];
        if (b[sp] >1) break;
        
        next = a[sp];
        sp = next;
        num++;
        
        if (next == 2) {
            can =true;
            break;
        }
    }
    
    if(can) cout << num << endl;
    else cout << -1 <<endl;
    
    return 0;
}

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


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

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

    double N; cin >> N;
    double a=N/3.0;
    cout << a*a*a << endl;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//#define int long long


int main() {
  int a, b;
  cin >> a >> b;
  
  cout << (a+b)%24 << endl;
  
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

const ll INF = 1LL << 61;

struct Edge {
  ll t;
  ll cost;
};

void solve() {
  ll N, M;
  cin >> N >> M;
  vector<vector<Edge>> G(N);
  for (ll i = 0; i < M; i++) {
    ll a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    G[a].push_back({b, c});
  }
  vector<ll> dist(N, -INF);
  dist[0] = 0;
  
  bool update = true;
  ll cnt = 0;
  ll las = -INF;
  while(update) {
    update = false;
    for (ll i = 0; i < N; i++) {
      for(ll j = 0; j < G[i].size(); j++) {
        if (dist[G[i][j].t] < dist[i] + G[i][j].cost) {
          dist[G[i][j].t] = dist[i] + G[i][j].cost;
          update = true;
        }
      }
    }
    cnt++;
    if (cnt == N - 1) {
      las = dist.back();
    }
    if (cnt >= N) break;
  }
  if (cnt >= N) {
    if (las == dist.back()) {
      cout << dist.back() << endl;
    } else {
      cout << "inf" << endl;
    }
  } else {
    cout << dist.back() << endl;
  }
  
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define pb(v, a) v.push_back(a)
#define Sort(v) sort(v.begin(), v.end())
#define INF 0x3f3f3f3f
#define For(m) for (auto it = m.begin(); it != m.end(); it++)
#define mod 1000000007
using namespace std;
vector<ll>graph[100005];
bool visit[100005];
ll dp[100005];
void dfs(ll u)
{
    visit[u]=true;
      For(graph[u])
      {
          ll v=*it;
          if(!visit[v])
          {
          dfs(v);
          }
          dp[u]=max(dp[u],dp[v]+1);
      }
}

int main()
{
  ll n;
  cin >> n;
  ll m;
  cin >> m;
  fr(i, 0, 100005)dp[i]=0;
   fr(i, 0, m) {
    ll u, v;
    cin >> u >> v;
    pb(graph[u], v);
  //  pb(graph[v], u);
  } 
  memset(visit,false,sizeof(visit));
  fr(i,1,n+1)
  {
        if(visit[i]==false)
        {
            dfs(i);
        }
  }
  ll m1=dp[1];
  fr(i,1,n+1)
  {
      m1=max(m1,dp[i]);
  }
  cout << m1 << endl;

  
  return 0;
}


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

int main()
{
    int n,t;

    while(cin>>n>>t)
    {
        int cost,time;
        int res=9999;

        for(int i=0;i<n;i++)
        {
            cin>>cost>>time;

            if(time<=t)
                res=min(res,cost);
        }
        if(res==9999)
            cout<<"TLE"<<endl;
        else
            cout<<res<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
using namespace std;

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <stack>
#include <bitset>

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

	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			cnt++;		
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
n,w=map(int,input().split())
wv=[list(map(int,input().split())) for i in range(n)]
wv.sort(key=lambda x:-x[1])#reverse
wv.sort(key=lambda x:x[0])
#print(wv)
w0=wv[0][0]
x=[[0],[0],[0],[0]]
for i in range(n):
    z=wv[i][0]-w0
    k=wv[i][1]+x[z][-1]
    l=len(x[z])
    if l*wv[i][0]<=w:
        x[z].append(k)
ma=0
l3=len(x[3])
l2=len(x[2])
l1=len(x[1])
for i in range(l3):
    for j in range(l2):
        d=w-i*(w0+3)-j*(w0+2)
        if d>=0:
            for k in range(l1):
                d=w-i*(w0+3)-j*(w0+2)-k*(w0+1)
                if d>=0:
                    ma_sub=x[3][i]+x[2][j]+x[1][k]+x[0][min(d//w0,len(x[0])-1)]
                    ma=max(ma,ma_sub)
                else:
                    break
        else:
            break

print(ma)


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

using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif






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

    IOS;
    
   int n;
   cin>>n;
   map<string, int> m;
   while(n--)
   {
      string s;
      cin>>s;
      m[s]++;
   }

   cout<<"AC x "<<m["AC"]<<endl;
   cout<<"WA x "<<m["WA"]<<endl;
   cout<<"TLE x "<<m["TLE"]<<endl;
   cout<<"RE x "<<m["RE"]<<endl;

}

Measured memory_bytes: 3624
# -*- coding: utf-8 -*-
#ABC137B
import copy
import sys
import math

#n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

k=hoge[0]
x=hoge[1]

ans=""
for i in range(0,2*k-1):
	if((x-k+1+i) >=(-1000000))and((x-k+1+i)<=1000000):
		if(len(ans)!=0):
			ans+=" "
		ans+=str(x-k+1+i)

print(ans)


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

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

    int max = 0;
    int cur = 0;
    for (int i = 0; i < s.size(); i++) {
        char c = s[i];
        if (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
            cur++;
        } else {
            if (cur > max) {
                max = cur;
            }
            cur = 0;
        }
    }
    if (cur > max) {
        max = cur;
    }

    cout << max << endl;
}

Measured memory_bytes: 3624
ss, t = input(), input()
lt = len(t)
lss = len(ss)
lst = []
for i in range(lss - lt + 1):
    tss = ss[i:i + lt]
    tb = True
    for a, b in zip(tss, t):
        if a == '?':
            continue
        elif a != b:
            tb = False
            break
    if tb:
        lst.append(ss[:i] + t + ss[i + lt:])
if len(lst):
    lst.sort()
    print(lst[0].replace('?', 'a'))
else:
    print('UNRESTORABLE')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define nes ios_base :: sync_with_stdio(0); cin.tie(0);
using namespace std;
const ll m=1e9+7;
ll mod(ll x){
	return ((x%m+m)%m);
}
ll add(ll a,ll b){
	return(mod(mod(a)+mod(b)));
}
ll mul(ll a,ll b){
	return (mod(mod(a)*mod(b)));
}
int main(){
	nes;
	ll n;
	cin>>n;
	vector<ll>v(n);
	ll sum=0,sum1=0,res=0;
	for(ll i=0;i<n;++i){
		cin>>v[i];
		sum=add(sum,v[i]);
	}
	for(ll i=0;i<n;++i){
		sum-=v[i];
		sum=mod(sum);
		res=add(res,mul(sum,v[i]));
	}
	cout<<res;
	return 0;
}

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

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


  vector<int> a(4, 0);
  rep(i, 4){
    a[i] = s[i] - '0';
  }

  int num = a[0], cnt = 1;
  for(int i = 1; i < 4; i++){
    if(a[i] == num){
      cnt++;
      if(cnt >= 3) break;
    }else{
      num = a[i]; cnt = 1;
    } 
  }

  if(cnt >= 3){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  } 

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx,tune=native")

#include <bits/stdc++.h>

using namespace std;

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

template<typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;

#define se second
#define fi first
#define pb push_back

string grid[400];

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i = 0; i < n; ++i) {
    	cin>>grid[i];
    }
    int cnt = 0;
    for(int i = 0; i < n; ++i) {
    	bool flag = false;
    	for(int j =0; j < n; ++j) {
    		for(int k = 0; k < n; ++k) {
    			if(grid[k][(i+j)%n] !=grid[j][(i+k)%n]) {
    				flag = true;
    				break;
    			}
    		}
    		if(flag) {
    			break;
    		}
    	}
    	/*if(flag) {
    		continue;
    	}
    	for(int j =0; j < n; ++j) {
    		char ch = grid[n-1][(n-1+i-j)%n];
    		for(int k = 0; k <= j; ++k) {
    			if(grid[n-1-k][(2*n-1+i-j+k)%n] !=ch) {
    				flag = true;
    				break;
    			}
    		}
    		if(flag) {
    			break;
    		}
    	}*/
    	if(!flag) {
    		cnt+=n;
    	}
    }
    cout<<cnt<<endl;
}

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

using namespace std;

const int N = 105;

int n, x[N], y[N], h[N];
pair <int, int> a[N];

bool cmp (pair <int, int> p1, pair <int, int> p2) {
    if (p1.second != p2.second) return p1.second < p2.second;
    return p1.first < p2.first;
}

void solve (int cx, int cy) {
    for (int i = 1; i <= n; i++) {
        if (h[i] > 0) a[i].first = a[i].second = h[i] + abs(cx - x[i]) + abs(cy - y[i]);
        else a[i].first = 0, a[i].second = abs(cx - x[i]) + abs(cy - y[i]);
    }

    sort(a + 1, a + n + 1, cmp);
    int l = a[1].first, r = a[1].second;
    for (int i = 2; i <= n; i++) {
        if (a[i].first < l) continue;
        if (a[i].first >= l && a[i].first <= r) l = a[i].first;
        if (a[i].first > r) return;
    }

    if (l == r) {
        cout << cx << " " << cy << " " << l;
        exit(0);
    }
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> x[i] >> y[i] >> h[i];
    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            solve(cx, cy);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define gc getchar()
#define pc(x) putchar(x)
template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;}
template<typename T> void printn(T n){bool _=0;_=n<0;n=_?-n:n;char snum[65];int i=0;do{snum[i++]=n%10+48;n/= 10;}while(n);--i;if (_)pc(45);while(i>=0)pc(snum[i--]);}
template<typename First, typename ... Ints> void scan(First &arg, Ints&... rest){scan(arg);scan(rest...);}
template<typename T> void print(T n){printn(n);pc(10);}
template<typename First, typename ... Ints> void print(First arg, Ints... rest){printn(arg);pc(32);print(rest...);}

using namespace std;



int main(){
	int x;
	scan(x);
	puts(x >= 30 ? "Yes" : "No");
}

Measured memory_bytes: 3564
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] num = br.readLine().split(" ");
		int n = Integer.parseInt(num[0]);
		int m = Integer.parseInt(num[1]);
		Integer[][] list = new Integer[n][m];
		Integer[] multipler = new Integer[m];

		for (int i = 0; i < n; i++) {
			String[] str = br.readLine().split(" ");
			for (int j = 0; j < m; j++) {
				list[i][j] = Integer.parseInt(str[j]);
			}
		}
		for (int i = 0; i < m; i++) {
			multipler[i] = Integer.parseInt(br.readLine());
		}

		for (int i = 0; i < n; i++) {
			int sum = 0;
			for (int j = 0; j < m; j++) {
				sum += list[i][j] * multipler[j];
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 27748
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define MOD 1e9+7;
using namespace std;
using Graph = vector<vector<int>>;
typedef vector<vector<char>> field_t;
typedef long long ll;
typedef pair<int, int> point_t;
vector<vector<pair<int,int>>> z(100010);
 
 
signed main()
{
    ll A,B,ans;
    cin >> A >> B;
    ans=A*B;
    cout << ans <<endl;
  
 
 
    return 0;
}

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

int main() {

	int n; cin >> n;

	int c = 0;

	for (int i = 1; i < n; i++)
		for (int j = 1; i*j < n; j++) {
			if (i*j + n - i * j == n && n - i * j > 0)
				c++;
		}

	cout << c << endl;

}

Measured memory_bytes: 3580
#include<cstdio>
#include<algorithm>
using namespace std;
int a[200005];
int lm[200005];
int rm[200005];
int main(void)
{
    int n;
    scanf("%d" ,&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d" ,&a[i]);
        lm[i]=max(lm[i-1],a[i-1]);
    }
    for(int i=n;i>=1;i--)
        rm[i]=max(rm[i+1],a[i+1]);
    for(int i=1;i<=n;i++)
        printf("%d\n" ,max(lm[i],rm[i]));
    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

int main() {
    using vi = vector<int>;
    
    string s;
    cin >> s;
    int a = s.size();
    int count = 0;
    rep(i,(a-1)/2+1){
        if(s.at(i) != s.at(a-i-1)){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
/*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1142&lang=jp*/
#include <iostream>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
    int m;

    cin>>m;
    for (int i = 0; i < m; ++i) {
        string str;
        set<string> strings;

        cin>> str;
        for (unsigned int j = 1; j < str.length(); ++j) {
            string s1= str.substr(0,j);
            string s2= str.substr(j);

            for (int k = 0; k < 2; ++k) {
                for (int l = 0; l < 2; ++l) {
                    string s1tmp = s1;
                    string s2tmp = s2;

                    if(k==1){
                        reverse(begin(s1tmp),end(s1tmp));
                    }
                    if(l==1){
                        reverse(begin(s2tmp),end(s2tmp));
                    }
                    strings.insert(s1tmp+s2tmp);
                    strings.insert(s2tmp+s1tmp);
                }
            }
        }
        cout<<strings.size()<<endl;
    }
    return 0;
}

Measured memory_bytes: 1292
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int n;
bool g[110][110];
int d[110];

void bfs(int s)
{
	d[s] = 0;
	queue<int> q;
	q.push(s);

	while (!q.empty()) {
		int u = q.front();
		q.pop();
		for (int i = 1; i <= n; i++) {
			if (g[u][i] && d[i] == -1) {
				q.push(i);
				d[i] = d[u] + 1;
			}
		}
	}
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		int u, k, v;
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v;
			g[u][v] = true;
		}
	}

	for (int i = 1; i <= n; i++) d[i] = -1;

	bfs(1);

	for (int i = 1; i <= n; i++)
		cout << i << " " << d[i] << endl;

	return 0;
}

Measured memory_bytes: 1212
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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 $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:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

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

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        s: chars,
    }
    for i in 0..s.len() {
        if i % 2 == 0 && s[i] == 'L' {
            puts!("No\n");
            return;
        }
        if i % 2 == 1 && s[i] == 'R' {
            puts!("No\n");
            return;
        }
    }
    puts!("Yes\n");
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

#define rep(i,b) for(long long i = 0; i < (b); i++)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
using ll = long long;

ll lcm(ll a,ll b){
	
	return (a*b)/(__gcd(a,b));
}
void solve() 
{
	int k;
	cin>>k;
	int val=7%k;
	for(int i=1;i<1e7;i++){
		if(val==0){
			cout<<i;
			return ;
		}
		val=(10*val+7)%k;
}
cout<<-1;
return ;
}



int  main(){

		solve();
		cout<<endl;

}
	

	

	

	

Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *
from copy import *

def tpsort(es, ordered = False):
    n = len(es)
    indgr = [0] * n
    for e in es:
        for u in e:
            indgr[u] += 1
    if ordered:
        from heapq import heappop, heappush
        st = []
        for v in range(n):
            if indgr[v] == 0: heappush(st, v)
        ret = []
        while st:
            v = heappop(st)
            ret.append(v)
            for u in es[v]:
                indgr[u] -= 1
                if indgr[u] == 0: heappush(st, u)
    else:
        st = [v for v in range(n) if indgr[v] == 0]
        ret = []
        while st:
            v = st.pop()
            ret.append(v)
            for u in es[v]:
                indgr[u] -= 1
                if indgr[u] == 0: st.append(u)
    if len(ret) == n:
        return ret
    else:
        return False

H, W = map(int, input().split())
f = [input() for i in range(H)]
mod = 10**9+7
dp = [[0]*W for i in range(H)]
dp[0][0] = 1
q = deque()
q.append((0, 0))
visit = [[1] * W for i in range(H)]
while q:
    i, j = q.popleft()
    if visit[i][j] == 0:
        continue
    visit[i][j] = 0
    if i+1 < H and visit[i+1][j] and f[i+1][j] == '.':
        q.append((i+1, j))
        dp[i+1][j] = (dp[i+1][j]+dp[i][j])%mod
    if j+1 < W and visit[i][j+1] and f[i][j+1] == '.':
        q.append((i, j+1))
        dp[i][j+1] = (dp[i][j+1]+dp[i][j])%mod
print(dp[H-1][W-1])


Measured memory_bytes: 80984
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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

//const int dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;
vector<ll> ans;

map<ll,ll> m;


int main()
{
	ll n;
	ll tmp;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		a.push_back(tmp);
		ans.push_back(tmp);
	}
	
	for (int i = 0; i < n; i++) {
		if (a[i]==1) {
			ans[0] = i+1;
		}
		else if (a[i] == n) {
			ans[n-1] = i+1;
		}
		else {
			ans[a[i]-1] = i+1;
		}
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << " ";
	}

	return 0;
}





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

#define int long long

signed main(){
  ios::sync_with_stdio( 0 );
  int n; cin >> n;
  vector< int > a( n );
  for( int i = 0; i < n; ++i ){
    cin >> a[ i ];
  }
  sort( a.begin(), a.end() );
  vector< int > pfx( n + 1 );
  for( int i = 0; i < n; ++i ){
    pfx[ i + 1 ] = pfx[ i ] + a[ i ];
  }
  for( int i = n - 1; i >= 0; --i ){
    if( a[ i ] > 2LL * pfx[ i ] ){
      cout << n - i << endl;
      exit( 0 );
    }
  }
  return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

/**
 * Candies
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int K = sc.nextInt();
            int[] A = new int[N + 1];
            for (int i = 1; i <= N; i++) {
                A[i] = sc.nextInt();
            }

            long[][] dp = new long[N + 1][K + 1];
            dp[0][0] = 1;

            for (int i = 1; i <= N; i++) {
                for (int j = 0; j <= K; j++) {
                    dp[i][j] = dp[i - 1][j];

                    if (j > 0 && A[i] > 0) {
                        dp[i][j] += dp[i][j - 1];
                        if (j - A[i] - 1 >= 0) {
                            dp[i][j] -= dp[i - 1][j - A[i] - 1];
                        }

                        dp[i][j] = (dp[i][j] + 1000000007) % 1000000007;
                    }
                }
            }

            System.out.println(dp[N][K]);
        }
    }

}


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


int main()
{

    int n,m,l;
    cin>>n>>m>>l;
    if(n+m+l>=22)
    {
        cout<<"bust";
    }
    else{
        cout<<"win";
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define LENGTH 100000

typedef struct pp{
    char name[100];
    int time;
} P;

int head, tail;
P Q[LENGTH];

void enqueue(P x){
    Q[tail] = x;
    tail = (tail+1) % LENGTH;
}

P dequeue(){
    P x = Q[head];
    head = (head+1) % LENGTH;
    return x;
}

int min(int a, int b){
    if(a <= b){
        return a;
    }
    else{
        return b;
    }
}

int main(void){
    int N;
    int q;
    scanf("%d %d",&N, &q);
    head = 0;
    tail = N;
    for(int i = 0; i < N; i++){
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].time);
    }
    P u;
    int elaps = 0, c;
    while(head != tail){
        u = dequeue();
        c = min(q, u.time);
        elaps += c;
        u.time -= c;
        if(u.time > 0){
            enqueue(u);
        }
        else{
            printf("%s %d\n", u.name, elaps);
        }
    }
    return 0;
}


Measured memory_bytes: 11896
#
# File    : C.rb
# Author  : Kazune Takahashi
# Created : 2018-11-4 21:06:08
# Powered by Visual Studio Code
#

n, m = gets.chomp.split(" ").map{|i| i.to_i}
pref = Array.new(n){[]}
for i in 0...m
  pa, y = gets.chomp.split(" ").map{|i| i.to_i}
  pref[pa - 1] << [y, i]
end

ans = []

for i in 0...n
  pref[i].sort!
  for j in 0...pref[i].size
    ans << [pref[i][j][1], (i+1).to_s.rjust(6, "0") + (j+1).to_s.rjust(6, "0")]
  end
end

ans.sort.each{|cnt, a|
  puts a

}

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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> v(n),w(n);
  for(Int i=0;i<n;i++) cin>>v[i]>>w[i];
  
  const Int INF = 1e8;
  vector<Int> dp(m+1,-INF);
  dp[0]=0;
  for(Int i=0;i<n;i++)
    for(Int j=m;j>=0;j--)
      if(j+w[i]<=m) chmax(dp[j+w[i]],dp[j]+v[i]);
  
  Int ans=0;
  for(Int i=0;i<=m;i++) chmax(ans,dp[i]);
  cout<<ans<<endl;
  return 0;
}



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

const ll MX = 1e18;
const long double PI = acos(-1);

int main()
{
    int k,n;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    rep(i,k)
    {
        ans += a[i];
    }
    pri(ans);
    return 0;
}


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

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N = 0, W = 0;
    cin >> N >> W;

    std::vector<long long> w(N + 1, 0);
    std::vector<long long> v(N + 1, 0);

    for (int i = 1; i <= N; i++)
    {
        cin >> w[i] >> v[i];
    }

    vector<vector<long long>> dp(N + 1, vector<long long>(W + 1, 0));

    for (long long i = 1; i <= N; i++)
    {
        for (long long j = 0; j <= W; j++)
        {
            // cout << j << " - w[" << i << "] = " << (int)(j - w[i]) << endl;
            if (j - w[i] < 0)
            {
                // cout << "dp[" << i << "][" << j << "] (" << dp[i][j] << ") <= dp[" << i - 1 << "][" << j << "] (" << dp[i - 1][j] << ")" << endl;
                dp[i][j] = dp[i - 1][j];
            }
            else
            {
                // cout << "dp[" << i << "][" << j << "] (" << dp[i][j] << ") <= max(dp[" << i - 1 << "][" << j - w[i] << "], dp[" << i - 1 << "][" << j << "]) (" << max(dp[i - 1][j - w[i]] + v[i], dp[i - 1][j]) << ")" << endl;
                dp[i][j] = max(dp[i - 1][j - w[i]] + v[i], dp[i - 1][j]);
            }
            // cout << "dp[" << i << "][" << j << "] = " << dp[i][j] << endl;
        }
        // cout << "dp[" << i << "][W] = " << dp[i][W] << endl;
    }

    cout << dp[N][W] << endl;

    return 0;
}


Measured memory_bytes: 80256
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

h,w = li()
grid = [lc() for _ in range(h)]
new_h = []
new_w = []

for hi in range(h):
    if "#" in grid[hi]:
        new_h.append(hi)

for wj in range(w):
    for hi in range(h):    
        if "#" in grid[hi][wj]:
            new_w.append(wj)
            break
        
ans = [["" for _ in range(len(new_w))] for _ in range(len(new_h))]

for i,nhi in enumerate(new_h):
    for j,nwj in enumerate(new_w):
        ans[i][j] = grid[nhi][nwj]
        
for row in ans:
    print("".join(row))

Measured memory_bytes: 3316
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        List<List<Integer>> s = new ArrayList<>(M);
        for(int i = 0; i < M; i++) {
            int k = sc.nextInt();
            s.add(new ArrayList<>(k));
            for(int j = 0; j < k; j++) {
                int a = sc.nextInt();
                a--;
                s.get(i).add(a);
            }
        }
        List<Integer> p = new ArrayList<>();
        for(int i = 0; i < M; i++) {
            p.add(sc.nextInt());
        }

        long res = 0;
        for(int bit = 0; bit < (1 << N); bit++) {
            boolean ok = true;
            for(int i = 0; i < M; i++) {
                int count = 0;
                for(int t : s.get(i)) {
                    if(((bit >> t) & 1) == 1) count++;
                }
                if(count % 2 != p.get(i)) ok = false;
            }
            if(ok) res++;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 37472
def main():
    N = int(input())
    a = list(map(int, input().split()))

    ans = 0
    for i, aa in enumerate(a, 1):
        if i % 2 == 1 and aa % 2 == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9160
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 105
using namespace std;
inline int read(){
	int sum = 0, t = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){ if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9'){ sum = sum * 10 + ch - '0'; ch = getchar(); }
	return sum * t;
}

int n, W;
int w[N], v[N];
int S[4][N], tp[4], ans;

int main(){
	n = read(); W = read();
	for(int i = 1; i <= n; i++){
		w[i] = read(); v[i] = read();
		int ty = w[i] - w[1];
		S[ty][++tp[ty]] = v[i];
	}
	for(int i = 0; i < 4; i++)
		sort(S[i] + 1, S[i] + tp[i] + 1),
		reverse(S[i] + 1, S[i] + tp[i] + 1);
	for(int i = 0; i < 4; i++)
		for(int j = 1; j <= tp[i]; j++)
			S[i][j] += S[i][j - 1];
	for(int i = 0; i <= tp[0] && i * w[1] <= W; i++)
		for(int j = 0; j <= tp[1] && i * w[1] + j * (w[1] + 1) <= W; j++)
			for(int k = 0; k <= tp[2] && i * w[1] + j * (w[1] + 1) + k * (w[1] + 2) <= W; k++)
				for(int l = 0; l <= tp[3] && i * w[1] + j * (w[1] + 1) + k * (w[1] + 2) + l * (w[1] + 3) <= W; l++)
					ans = max(ans, S[0][i] + S[1][j] + S[2][k] + S[3][l]);
	printf("%d\n", ans);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
const int M=100010;
const int MOD=1000000007;
const int INF=1000000007;
using ll=long long;

int main() {
	string s;
	int n,k;
	cin>>n>>k>>s;
	if(s[k-1]=='A')s[k-1]='a';
	if(s[k-1]=='B')s[k-1]='b';
	if(s[k-1]=='C')s[k-1]='c';
	cout<<s<<endl;
	
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    B=[0]*n
    B[0]=sum(A)-sum(A[1::2])*2
    for i in range(1,n):
        B[i]=(A[i-1]-B[i-1]//2)*2
    print(*B)
    
if __name__=='__main__':
    main()

Measured memory_bytes: 14616
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

struct node{
	node *left;
	node *right;
	node *parent;
	int key;
};

struct tree{
	node *nil;
	node *root;
};

void insert(tree *t, int id){
	node *x, *y, *n;
	n = new node;
	n->key = id;
	n->left = t->nil;
	n->right = t->nil;
	x = t->root;
	while(x != t->nil){
		y = x;
		if(id > x->key){
			x = x->right;
		}
		else{
			x = x->left;
		}
	}
	if(id > y->key){
		y->right = n;
	}
	else{
		y->left = n;
	}
	n->parent = y;
}

node *toleft(tree *t, node *x){
	if (x->left == t->nil) return x;
	else return toleft(t, x->left);
}

node *relink(tree *t, node *del){
	node *child, *ret;
	if ((del->left != t->nil) && (del->right != t->nil)){
		child = toleft(t, del->right);
		if(child->parent->key != del->key){
			child->parent->left = child->right;
		}
		else{
			child->parent->right = t->nil;
		}
		del->key = child->key;
		ret = del;
	}
	else{
		if(del->left != t->nil){
			ret = del->left;
		}
		else{
			ret = del->right;
		}
		if(ret != t->nil){
			ret->parent = del->parent;
		}
		
	}
	return ret;
}

void deleteNode(tree *t, int key){
	node *x, *y;
	x = t->root;
	while (x != t->nil){
		if (x->key == key){
			y = relink(t, x);
			if (x == (x->parent->left)){
				x->parent->left = y;
			}
			else{
				x->parent->right = y;
			}
			break;
		}
		else{
			if(key > x->key){
				x = x->right;
			}
			else{
				x = x->left;
			}
		}
	}
}
void find(tree *t, int key){
	node *x, *y;
	x = t->root;
	char str[4];
	
	strcpy(str, "no");
	while(x != t->nil){
		if (x->key == key){
			strcpy(str, "yes");
			break;
		}
		else if (key > x->key){
			x = x->right;
		}
		else{
			x = x->left;
		}
	}
	printf("%s\n", str);
}

void printIn(tree *t, node *n){
	if (n == t->nil){
		return ;
	}
	else{
		printIn(t, n->left);
		printf(" %d", n->key);
		printIn(t, n->right);
	}
}

void printPre(tree *t, node *n){
	if (n == t->nil){
		return ;
	}
	else{
		printf(" %d", n->key);
		printPre(t, n->left);
		printPre(t, n->right);
	}
}


int main(void){
	tree *t;
	t = new tree;
	char str[10];
	int i,id,n;
	scanf("%d", &n);
	
	t->root = new node;
	t->root->left = t->nil;
	t->root->right = t->nil;
	t->root->parent = t-> nil;
	for(i=0;i<n;i++){
		if(i==0){
			scanf("%s %d", str, &(t->root->key));
		}
		else{
			scanf("%s", str);
			if(str[0] == 'i'){
				scanf("%d", &id);
				insert(t, id);
			}
			else if(str[0] == 'p'){
				printIn(t, t->root);
				printf("\n");
				printPre(t, t->root);
				printf("\n");
			}
			else if(str[0] ==  'f'){
				scanf("%d", &id);
				find(t, id);
			}
			else{
				scanf("%d", &id);
				deleteNode(t, id);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 21316
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    map<int, ll> mp;
    REP(i,N){
        cin >> A[i];
        mp[A[i]]++;
    }
    ll base = 0;
    for(auto x : mp) base += x.second * (x.second - 1) / 2;
    REP(i,N){
        ll tmp = mp[A[i]];
        //cout << tmp << endl;
        ll ans = base;
        ans -= tmp * (tmp - 1) / 2;
        tmp--;
        ans += tmp * (tmp - 1) / 2;
        cout << ans << endl;
    }
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
int n, k, ans;
int a[1010];
int main() {
	cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + 1 + n);
	for (int i = 1; i <= k; i++) ans += a[i];
	cout << ans;
	return 0;
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(a<=b&&b<=c){
    cout<<a<<" "<<b<<" "<<c<<endl;
  }else   if(a<=c&&c<=b){
    cout<<a<<" "<<c<<" "<<b<<endl;
  }else   if(b<=a&&a<=c){
    cout<<b<<" "<<a<<" "<<c<<endl;
  }else   if(b<=c&&c<=a){
    cout<<b<<" "<<c<<" "<<a<<endl;
  }else   if(c<=a&&a<=b){
    cout<<c<<" "<<a<<" "<<b<<endl;
  }else   if(c<=b&&b<=a){
    cout<<c<<" "<<b<<" "<<a<<endl;
  }
  return 0;
}



Measured memory_bytes: 3076
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define elif else  if
#define INF 1000000009
using namespace std;
int a,b;
signed main(){
	cin>>a>>b;
	if(a>9||b>9){
		cout<<-1;
	}else{
		cout<<a*b;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <tuple>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int INF = 1e+12;

void chmin(int &a, int b) { a = min(a, b); }

int h, n;
int a[1000], b[1000];
int dp[1001][10001];


signed main() {
	int i, j;
	
	cin >> h >> n;
	rep(i, n) cin >> a[i] >> b[i];
	
	rep(i, n + 1) rep(j, h + 1) dp[i][j] = INF;
	dp[0][0] = 0;
	
	rep(i, n) {
		rep(j, h + 1) {
			chmin(dp[i + 1][j], dp[i][j]);
			chmin(dp[i][min(h, j + a[i])], dp[i][j] + b[i]);
		}
	}
	
	cout << dp[n][h] << endl;
	return 0;
}

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

typedef long long int ll;

int main(){
  int R,G,B,N;
  cin >> R >> G >> B >> N;
  long long ans = 0;
  for(int i = 0;i < N / R + 1;i++){
    for(int j = 0;j < N / G + 1;j++){
      for(int k = 0;k < N / B + 1;k++){
        if(i * R + j * G + k * B == N){
          ans++;
          /*cout << i << '/' << j << '/' << k << endl;*/
        }if(i * R + j * G + k * B > N){
          break;
        }
        if(i * R + j * G + (k+100) * B < N){
          k += 99;
        }
      }
    }
  }
  cout << ans << endl;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	int P[20];
	int ans = 0;
	cin >> N;
	rep(i, 0, N)
	{
		cin >> P[i];
		ans += P[i];
	}

	sort(P, P + N);

	cout << ans - P[N - 1] / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
from collections import deque


class Mint:
    MOD = 1000000007  # Must be a prime
    CACHE_FACTORIALS = [1, 1]

    def __init__(self, v):
        if self.__isally(v):
            self.v = v.v % self.MOD
        else:
            self.v = v % self.MOD

    @property
    def inv(self):
        return Mint(self.__minv(self.v))

    @classmethod
    def factorial(cls, v):
        for i in range(len(cls.CACHE_FACTORIALS), int(v) + 1):
            cls.CACHE_FACTORIALS.append(cls.CACHE_FACTORIALS[-1] * i % cls.MOD)
        return Mint(cls.CACHE_FACTORIALS[int(v)])

    @classmethod
    def perm(cls, n, r):
        if n < r or r < 0:
            return 0
        return cls.factorial(n) // cls.factorial(n - r)

    @classmethod
    def comb(cls, n, r):
        if n < r or r < 0:
            return 0
        return cls.perm(n, r) // cls.factorial(r)

    @classmethod
    def __isally(cls, v) -> bool:
        return isinstance(v, cls)

    @classmethod
    def __minv(cls, v) -> int:
        return pow(v, cls.MOD - 2, cls.MOD)

    @classmethod
    def __mpow(cls, v, w) -> int:
        return pow(v, w, cls.MOD)

    def __str__(self):
        return str(self.v)
    __repr__ = __str__

    def __int__(self):
        return self.v

    def __eq__(self, w):
        return self.v == w.v if self.__isally(w) else self.v == w

    def __add__(self, w):
        return Mint(self.v + w.v) if self.__isally(w) else Mint(self.v + w)
    __radd__ = __add__

    def __sub__(self, w):
        return Mint(self.v - w.v) if self.__isally(w) else Mint(self.v - w)

    def __rsub__(self, u):
        return Mint(u.v - self.v) if self.__isally(u) else Mint(u - self.v)

    def __mul__(self, w):
        return Mint(self.v * w.v) if self.__isally(w) else Mint(self.v * w)
    __rmul__ = __mul__

    def __floordiv__(self, w):
        return Mint(self.v * self.__minv(w.v)) if self.__isally(w) else Mint(self.v * self.__minv(w))

    def __rfloordiv__(self, u):
        return Mint(u.v * self.__minv(self.v)) if self.__isally(u) else Mint(u * self.__minv(self.v))

    def __pow__(self, w):
        return Mint(self.__mpow(self.v, w.v)) if self.__isally(w) else Mint(self.__mpow(self.v, w))

    def __rpow__(self, u):
        return Mint(self.__mpow(u.v, self.v)) if self.__isally(u) else Mint(self.__mpow(u, self.v))


N, K = map(int, input().split())
tree = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)

ans = Mint(1)
q = deque()
q.append((1, 0, 0))
while len(q):
    n, i, prev = q.pop()
    if K - i <= 0:
        print(0)
        exit()
    ans *= K - i
    j = 1 if i == 0 else 2
    for m in tree[n]:
        if prev == m:
            continue
        q.append((m, j, n))
        j += 1
print(ans)


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

int A, B, C, D;

void solve(){
	if(D <= A || B <= C) printf("0\n");
	else if(A <= C && D <= B) printf("%d\n", D - C);
	else if(C <= A && B <= D) printf("%d\n", B - A);
	else if(A <= C && C <= B) printf("%d\n", B - C);
	else printf("%d\n", D - A);
}

int main(){
	scanf("%d %d %d %d", &A, &B, &C, &D);
	solve();
	return 0;
}


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

int main(){
    int n;
    while(true) {
        cin >> n;
        if(n==0) break;
        vector<int> face(6);
        int score=1;
        face[0]=1;
        face[1]=2;
        face[2]=3;
        face[3]=5;
        face[4]=4;
        face[5]=6;
        for(int i=0; i<n; ++i){
            string dir;
            cin >> dir;
            if(dir=="North") {
                int temp;
                temp=face[0];
                face[0]=face[1];
                face[1]=face[5];
                face[5]=face[3];
                face[3]=temp;
            } else if(dir=="East") {
                int temp;
                temp=face[0];
                face[0]=face[4];
                face[4]=face[5];
                face[5]=face[2];
                face[2]=temp;
            } else if(dir=="West") {
                int temp;
                temp=face[0];
                face[0]=face[2];
                face[2]=face[5];
                face[5]=face[4];
                face[4]=temp;
            } else if(dir=="South") {
                int temp;
                temp=face[0];
                face[0]=face[3];
                face[3]=face[5];
                face[5]=face[1];
                face[1]=temp;
            } else if(dir=="Right") {
                int temp;
                temp=face[1];
                face[1]=face[2];
                face[2]=face[3];
                face[3]=face[4];
                face[4]=temp;
            } else if(dir=="Left") {
                int temp;
                temp=face[1];
                face[1]=face[4];
                face[4]=face[3];
                face[3]=face[2];
                face[2]=temp;
            }
            score+=face[0];
        }
        cout << score << endl;
    }
    return 0;
}



Measured memory_bytes: 3032