akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());

long double a[]={35.5,37.5,40.0,43.0,50.0,55.0,70.0,100000000.0};
long double b[]={71.0,77.0,83.0,89.0,105.0,116.0,148.0,100000000.0};
string c[]={"AAA","AA","A","B","C","D","E","NA"};
int main(){
	long double x,y;
	while(cin>>x>>y){
		int t=0;
		rep(i,8){
			if(x<a[i]){
				t=i;
				break;
			}
		}
		rep(i,8){
			if(y<b[i]){
				t=max(t,i);
				break;
			}
		}
		cout<<c[t]<<endl;
	}
}

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



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

    
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    int mini = 1e9;
    int ans = 0;
    for(int i=0;i<n;i++){
        if(mini > a[i]){
            ans++;
            mini = a[i];
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int h=sc.nextInt();
        int w=sc.nextInt();
        long ans=Long.MAX_VALUE;
        long a,b,c;
        a=h/3*w;
        b=(h-h/3)*(w/2);
        c=(h-h/3)*(w-w/2);
        ans=Math.min(ans,ans(a,b,c));
        a=(h/3+1)*w;
        b=(h-h/3-1)*(w/2);
        c=(h-h/3-1)*(w-w/2);
        ans=Math.min(ans,ans(a,b,c));
        
        a=h/3*w;
        b=(h-h/3)/2*w;
        c=(h-h/3-(h-h/3)/2)*w;
        ans=Math.min(ans,ans(a,b,c));
        
        a=w/3*h;
        b=(w-w/3)*(h/2);
        c=(w-w/3)*(h-h/2);
        ans=Math.min(ans,ans(a,b,c));
        a=(w/3+1)*h;
        b=(w-w/3-1)*(h/2);
        c=(w-w/3-1)*(h-h/2);
        ans=Math.min(ans,ans(a,b,c));
        
        a=w/3*h;
        b=(w-w/3)/2*h;
        c=(w-w/3-(w-w/3)/2)*h;
        ans=Math.min(ans,ans(a,b,c));
        
        System.out.println(ans);
    }
    public static long ans(long a,long b,long c){
        long max,min;
        max=Math.max(a,Math.max(b,c));
        min=Math.min(a,Math.min(b,c));
        return max-min;
    }
}


Measured memory_bytes: 21076
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 100000000;
const int MAX_N = 50;
using namespace std;
int main() {
	int N, M, X;
	cin >> N >> M >> X;
	int a[M + 5];
	for (int i = 0; i < M; i++) {
		cin >> a[i];
	}
	int x = 0, y = 0;
	for (int i = 0; i < M; i++) {
		if (a[i] < X) {
			x++;
		}
		if (a[i] > X) {
			y++;
		}
	}
	cout << min(x, y) << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
	    int n = IO.GetInt();
	    List<int> a = IO.GetIntList();
	    int count = 0;
	    int target = 1;
	    for(int i=0;i<n;i++){
	        if(a[i]==target){
	            target++;
	        }else{
	            count++;
	        }
	    }
	    Console.WriteLine((count!=n)?count:-1);
	}
    
}

static class IO
{
    static public string GetString() { return Console.ReadLine(); }
    static public int GetInt() { return int.Parse(Console.ReadLine()); }
    static public long GetLong() { return long.Parse(Console.ReadLine()); }
    static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
    static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
    static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
    static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
    static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
}


Measured memory_bytes: 35676
#include <iostream>
using namespace std;
 
int main(){
  int n,m,t,p;
 
  while(1){
    cin >> n >> m >> t >> p ;
 
    if(n==0 && m==0 && t==0 && p==0){
      break;
    }
 
    int Ori[64][64] = {{0}};
    for(int y=0;y<m;y++){
      for(int x=0;x<n;x++){
        Ori[y][x] = 1;
      }
    }
 
    for(int i=0;i<t;i++){
      int d,c;
      cin >> d >> c;
 
      if(d==1){
        for(int x=0;x<c;x++){
          for(int y=0;y<m;y++){
            Ori[y][2*c-1-x] += Ori[y][x];
            Ori[y][x] = 0;
          }
        }
 
        for(int x=0;x<n;x++){
          for(int y=0;y<m;y++){
            Ori[y][x] = Ori[y][x+c];
            Ori[y][x+c] = 0;
          }
        }
      }
      else{
        for(int y=0;y<c;y++){
          for(int x=0;x<n;x++){
            Ori[2*c-1-y][x] += Ori[y][x];
            Ori[y][x] = 0;
          }
        }
 
        for(int y=0;y<m;y++){
          for(int x=0;x<n;x++){
            Ori[y][x] = Ori[y+c][x];
            Ori[y+c][x] = 0;
          }
        }
      }
    }
 
    for(int i=0;i<p;i++){
      int x,y;
      cin >> x >> y;
 
      cout << Ori[y][x] << endl;
    }
  }
 
  return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <algorithm>
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; }

using pint = pair<int,int>;
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge> >;
Graph G;

long long all = 0;
long long res = 1LL<<60;
pint res_e = pint(1<<29, 1<<29);

struct LowLink {
    // main results
    vector<int> aps; // articulation points
    vector<pair<int,int> > brs; // brideges
    
    // intermediate results
    vector<int> seen, ord, low;

    // dp
    vector<long long> val;
    
    void dfs_lowlink(const Graph &G, int v, int p = -1) {
        static int time = 0;
        seen[v] = true;
        ord[v] = low[v] = time++;
        int num_of_child = 0;
        bool exist = false; // for articulation point
        for (auto e : G[v]) {
            int ch = e.first;
            long long w = e.second;
            if (seen[ch]) {
                if (ch != p) low[v] = min(low[v], ord[ch]), val[v] += w; // back edge
                continue;
            }
            dfs_lowlink(G, ch, v);
            val[v] += w + val[ch];
            low[v] = min(low[v], low[ch]); // forward edge of DFS-tree
            if (ord[v] < low[ch]) {
                brs.emplace_back(v, ch);
                long long diff = abs(val[ch] - (all - w - val[ch]));
				//cout << v << ", " << ch << ": " << val[ch] << ";; " << diff << endl;
				if (chmin(res, diff))
					res_e = pint(min(v, ch), max(v, ch));
				else if (res == diff)
					chmin(res_e, pint(min(v, ch), max(v, ch)));
            }
            if (ord[v] <= low[ch]) exist = true;
            ++num_of_child;
        }
        //cout << v << ": " << val[v] << endl;
        if ((p == -1 && num_of_child > 1) || (p != -1 && exist)) aps.emplace_back(v);
    }
    void solve(const Graph &G) {
        int N = (int)G.size();
        seen.assign(N, 0); ord.resize(N); low.resize(N); val.assign(N, 0);
        aps.clear(); brs.clear();
        for (int v = 0; v < N; ++v) if (!seen[v]) dfs_lowlink(G, v);
    }
};

int main() {
    int N, M; cin >> N >> M;
    G.clear(); G.resize(N);
    for (int i = 0; i < M; ++i) {
        int u, v; long long w; cin >> u >> v >> w; --u, --v;
        G[u].emplace_back(v, w);
        G[v].emplace_back(u, w);
        all += w;
    }
    for (int v = 0; v < N; ++v) {
        for (auto e : G[v]) {
			if (chmin(res, all - e.second))
				res_e = pint(min(v, e.first), max(v, e.first));
			else if (res == all - e.second)
				chmin(res_e, pint(min(v, e.first), max(v, e.first)));
        }
    }
    LowLink ll;
    ll.solve(G);
    cout << res_e.first+1 << " " << res_e.second+1 << endl;
}



Measured memory_bytes: 14540
/**
 *    author:  tourist
 *    created: 13.01.2020 23:48:43       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  double d1, x;
  cin >> n >> d1 >> x;
  d1 = 2 * d1 + x;
  x = 4 * x;
  double ans = 0;
  while (true) {
    ans += (d1 + (d1 + (n - 1) * x)) * 0.25;
    if (n == 1) {
      break;
    }
//    double new_d1 = (d1 * (2 * n - 1) + (d1 + x) * 3) / (2 * n);
//    double new_d2 = ((d1 + x) * (2 * n - 3) + (d1 + 2 * x) * 5) / (2 * n);
//    double new_d3 = ((d1 + 2 * x) * (2 * n - 5) + (d1 + 3 * x) * 7) / (2 * n);
//    double new_d1 = d1 * (n + 1) / n + x * 3 / (2 * n);
//    double new_d2 = d1 * (n + 1) / n + x * (2 * n + 7) / (2 * n);
//    double new_d3 = d1 * (n + 1) / n + x * (4 * n + 11) / (2 * n);
//    double new_x = new_d2 - new_d1;
    d1 = d1 * (n + 1) / n + x * 3 / (2 * n);
    x = x * (n + 2) / n;
    n -= 1;
  }
  cout << fixed << setprecision(17) << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); in.nextLine();
        Map<Character, Long> map = new HashMap<Character, Long>(){{
            put('M', 0L); put('A', 0L); put('R', 0L); put('C', 0L); put('H', 0L);
        }};
        for (int i = 0; i < n; i++) {
            char ch = in.nextLine().charAt(0);
            if(map.containsKey(ch)){
                map.put(ch, map.get(ch) + 1);
            }
        }
        long ans = 0;
        ans += map.get('M') * map.get('A') * map.get('R');
        ans += map.get('M') * map.get('A') * map.get('C');
        ans += map.get('M') * map.get('A') * map.get('H');
        ans += map.get('M') * map.get('R') * map.get('C');
        ans += map.get('M') * map.get('R') * map.get('H');
        ans += map.get('M') * map.get('C') * map.get('H');
        ans += map.get('A') * map.get('R') * map.get('C');
        ans += map.get('A') * map.get('R') * map.get('H');
        ans += map.get('A') * map.get('C') * map.get('H');
        ans += map.get('R') * map.get('C') * map.get('H');
        System.out.println(ans);
    }
}


Measured memory_bytes: 91724
def submit():
    k = int(input())
    a, b = map(int, input().split())

    if a % k == 0:
        print('OK')
        return
    elif b % k == 0:
        print('OK')
        return

    ak = a // k
    bk = b // k
    if ak != bk:
        print('OK')
    else:
        print('NG')
        

submit()

Measured memory_bytes: 9108
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int x;
  cin >> x;
 
  if (x <= 599 && x >= 400 ) {
    cout << "8" << endl;
  }
  if (x <=799 && x >=600 ) {
    cout << "7" << endl;
  }
   if (x <= 999&& x >=800 ) {
    cout << "6" << endl;
  }
   if (x <= 1199 && x >=1000 ) {
    cout << "5" << endl;
  }
   if (x <=1399 && x >=1200 ) {
    cout << "4" << endl;
  }
   if (x <= 1599&& x >= 1400) {
    cout << "3" << endl;
  }
   if (x <=1799 && x >=1600 ) {
    cout << "2" << endl;
  }
   if (x <=1999 && x >=1800 ) {
    cout << "1" << endl;
  }
 
}

Measured memory_bytes: 3628
fun main(args: Array<String>) {
    var (x,y) = readLine()!!.split(" ").map(String::toInt)
    var l1 = listOf(1,3,5,7,8,10,12)
    var l2 = listOf(4,6,9,11)
    var l3 = listOf(2)
    if(l1.contains(x)&&l1.contains(y) || l2.contains(x)&&l2.contains(y) || l3.contains(x)&&l3.contains(y)){
        println("Yes")
    }
    else println("No")
}


Measured memory_bytes: 37824
#include <stdio.h>
int main()
{
    int l,u;
    char c;
    scanf("%c",&c);
    l = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
    u = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
    if (l || u)
        printf("vowel\n");
    else
        printf("consonant\n");
    return 0;
}

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

int const INF = 1000000;

int main() {
  int N, X, Y;
  cin >> N >> X >> Y;
  X--; Y--;

  vector<vector<int> > D(N, vector<int>(N, INF));
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      int d = min(abs(X - i) + abs(j - Y) + 1, abs(Y - i) + abs(j - X) + 1);
      d = min(d, abs(j - i));
      D[i][j] = d;
    }
  }
  
  vector<int> ans(N);
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      ans[D[i][j]]++;
    }
  }
  
  for (int i = 1; i < N; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 16000
n = int(input())
a = list(map(int,input().split()))

count = 0
minabs = max(max(a),-min(a))
sumabs = 0
for i in range(n):
    if a[i] < 0:
        count += 1
        sumabs += -a[i]
    else:
        sumabs += a[i]
    minabs = min(minabs,abs(a[i]))
if count%2 == 0:
    print(sumabs)
else:
    print(sumabs-2*minabs)

Measured memory_bytes: 64752
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define mkp make_pair
//#define d double
void solve(){
	int n,T;
	cin>>n>>T;
	vpi vec(n);
	vi a(n+1),b(n+1);
	int rk=INT_MAX;
	rep(i,0,n) cin>>vec[i].f>>vec[i].se,rk=min(rk,vec[i].f);
	Sort(vec);
	rep(i,0,n) a[i+1]=vec[i].f,b[i+1]=vec[i].se;
	int dp[n+1][T];
	memset(dp,0,sizeof(dp));         
	for(int i=1;i<=n;i++){
		for(int j=1;j<=T-1;j++){
			dp[i][j]=max(max(dp[i-1][j],dp[i][j-1]),j-a[i]>=0?dp[i-1][j-a[i]]+b[i]:0);
		}
	}
	ll ans=0;
	for(int i=n;i>=1;i--){
		ans=max(ans,dp[i-1][T-1]+b[i]);
	}
	cout<<ans;
 
 
 
}
int32_t main(){
FIO;
int t=1;
//cin>>t;
while(t--){
	solve();
}
}

Measured memory_bytes: 35456
def main(n,m,l,a,b):
    ans = [[0]*l for _ in range(n)]
    _sum = 0
    for i in range(n):
        for j in range(l):
            for k in range(m):
                _sum += a[i][k]*b[k][j]
            ans[i][j] = _sum
            _sum = 0
    for x in ans:
        print(*x)

n,m,l = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(n)]
b = [list(map(int,input().split())) for _ in range(m)]
main(n,m,l,a,b)


Measured memory_bytes: 7056
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pi pair<int,int>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cout<<#x<<" "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const double eps = 1e-9;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
const int MAXN = 1e6 + 5;

ll sum(int l, int r, vector<ll> &pref)
{
    return (l ? pref[r] - pref[l - 1] : pref[r]);
}

void cp()
{
    int n, k;
    cin >> n >> k;
    vector<ll> less, more;
    bool has_zero = false;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        if(x < 0)
            less.pb(x);
        else if(x > 0)
            more.pb(x);
        else
            has_zero = true;
    }

    int pos_zero = 0;
    vector<ll> diff;

    if(!has_zero)
        k++;

    for(int i = 1; i < sz(less); i++)
    {
        diff.pb(abs(less[i] - less[i - 1]));
    }
    if(sz(less))
        diff.pb(abs(less.back()));

    pos_zero = sz(diff);
    diff.pb(0);

    if(sz(more))
        diff.pb(abs(more[0]));

    for(int i = 1; i < sz(more); i++)
    {
        diff.pb(abs(more[i] - more[i - 1]));
    }
    
    for(int i = 1; i < sz(diff); i++)
        diff[i] += diff[i - 1];
    // Get window of size k
    int i = 0, j = 0;
    while(j - i + 1 < k && j < sz(diff))
        j++;

    // Move window to include zero
    while(j < pos_zero)
        i++, j++;

    ll ans = INT_MAX;

    while(i <= pos_zero && j < sz(diff))
    {
        ll left = sum(i, pos_zero, diff);
        ll right = sum(pos_zero, j, diff);

        ans = min({ans, left * 2 + right, right * 2 + left});
        i++, j++;
    }
    cout << ans;
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 5768
s = input().split()
if s[0]==s[1] and s[0]!=s[2]:
    print("Yes")
elif s[0]==s[2] and s[0]!=s[1]:
    print("Yes")
elif s[1]==s[2] and s[0]!=s[1]:
    print("Yes")
else:
    print("No")    


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main()
{
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    for(int i = 0 ;i < n ; i++)
        cin>>h[i];
    vector<int> d(n + 1,INT_MAX);
    d[0] = 0;
    for(int i = 1 ; i < n ; i++)
    {
        for(int j = max(0,i - k) ; j < i; j++)
            d[i] = min(d[i],d[j] + abs(h[i] - h[j]));
    }
    cout<<d[n- 1]<<endl;

}

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

#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)

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

    double ans=0;
    for(int i=1;i<=n;i++){
        double tmp=1.0/n;
        int num=i;
        while(num<k){
            num*=2;
            tmp/=2;
        }
        ans += tmp;
    }
    
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);++i)

int main() {
  for (int N; cin >> N && N; ) {
      vector<int> a(N);
      REP(i, N) cin >> a[i];

      int ans = 0;
      map<int, int> count;
      for (;;) {
          count.clear();
          REP(i, N) ++count[a[i]];
          vector<int> b(N);
          REP(i, N) b[i] = count[a[i]];

          if (a == b) break;
          ans++;
          a = b;
      }
      cout << ans << endl;
      cout << a[0];
      for (int i = 1; i < N; i++) cout << " " << a[i]; cout << endl;

  }
  return 0;
}

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

int main(){
  long long N,M;
  cin>>N>>M;
  map<long long,long long> A;
  for(long long i=0;i<N;i++){
    long long a,b;
    cin>>a>>b;
    A[a]+=b;
  }
  long long j=0;
  for(pair<long long,long long> i:A){
    if(i.second>=M){
      cout<<j+M*i.first<<endl;
      return 0;
    }else{
      j+=i.first*i.second;
      M-=i.second;
    }
  }
}

Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <vector>
#include <queue>
using namespace std;
const int mod = 1e9 + 7;
typedef long long ll;
int n, k, x[22];
int dp[22][1010];
int fac[1010], ifac[1010];

int kmi (int x, int t) {
	int ans = 1;
	for (; t; t >>= 1, x = (ll)x * x % mod) 
		if (t & 1)
			ans = (ll)ans * x % mod;
	return ans;
}

int C (int n, int m) {
	if (m > n)
		return 0;
	// cerr << "test2 : " << n << " " << m << " " << (ll)fac[n] * ifac[m] % mod * ifac[n - m] % mod << endl;
	return (ll)fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}

int operation (int x, int z) {
	int ans = (ll)C(n - z, x - z) * ifac[z] % mod;
	// cerr << "test: " << x << " " << z << " " << n << " : " << ans << endl;
	return ans;
}

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> k;
	for (int i = 1; i <= k; i ++)
		cin >> x[i];
	fac[0] = ifac[0] = 1;
	for (int i = 1; i <=n; i ++) {
		fac[i] = (ll)fac[i - 1] * i % mod;
		ifac[i] = kmi (fac[i], mod - 2);
	}

	dp[0][0] = 1;
	for (int i = 1; i <= k; i ++)
		for (int j = 0; j <= n; j ++) {
			for (int k = j; k >= 0 && k >= j - x[i]; k --)
				(dp[i][j] += (ll)dp[i - 1][k] * operation(x[i], j - k) % mod) %= mod;
			// cerr << "dp " << i << " " << j << " = " << dp[i][j] << endl; 
		}
	cout << (ll)dp[k][n] * fac[n] % mod << endl;
	return 0;
}

Measured memory_bytes: 896
#include<iostream>
using namespace std;
int main(){
  int H,W,x,y;
  while(cin>>H>>W){
    if(H==0&&W==0) break;
    char space[W][H],c;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	cin >> space[j][i];
      }
    }
    x = y = 0;
    while(1){
      c = space[x][y];
      space[x][y] = '0';
      if(c=='>') x++;
      else if(c=='<') x--;
      else if(c=='v') y++;
      else if(c=='^') y--;
      else if(c=='.'){
	cout << x << ' ' << y << endl;
	break;
      }
      else if(c=='0'){
	cout << "LOOP" << endl;
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1168
H, W, N = map(int, input().split())
x, y = map(int, input().split())
S = input().rstrip()
T = input().rstrip()
L, R, U, D = 1, W, 1, H
for s, t in zip(reversed(S),reversed(T)):
    if t=="L": R = min(R+1,W)
    if t=="R": L = max(L-1,1)
    if t=="U": D = min(D+1,H)
    if t=="D": U = max(U-1,1)
    if s=="L": L = L+1
    if s=="R": R = R-1
    if s=="U": U = U+1
    if s=="D": D = D-1
    if L>R or U>D:
        print("NO")
        exit()
if L<=y<=R and U<=x<=D:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 74824
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

fn main() {
    let n: usize = util::get();
    let a: Vec<usize> = util::gets();

    let mut v = Vec::new();
    let mut i = n - 1;
    loop {
        v.push(a[i]);
        if i < 2 {
            break;
        }
        i -= 2;
    }
    if n >= 2 {
        let mut i = n % 2;
        while i < n {
            v.push(a[i]);
            i += 2;
        }
    }
    println!(
        "{}",
        v.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(
            " ",
        )
    );
}


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

int main()
{
  int n;
  cin >> n;
  ll ans = 0;

  for (int i = 1; i <= n; i++)
  {
    for (int j = 1; j <= n - i; j++)
    {
      if (i * j < n)
        // cout << i << ' ' << j << ' ' << endl;
        ans++;
      else
      {
        break;
      }
    }
  }

  cout << ans;
}


Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define ALL(a) a.begin, a.end()

using namespace std;

int main(void) {

	long N;

	cin >> N;

	long long max = ((N * (N + 1)) / 2) - N;

	cout << max << '\n';
	
	return 0;
}

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

#4,7何書いても良い

max_CA = int(N / 4) + int(N % 4) 
max_CB = int(N / 7) + int(N % 7)

#print(f'four:{max_CA}')
#print(f'seven:{max_CB}')

flag = False
for i in range(max_CA +1):
    for j in range(max_CB+1):
        sum_C = 4 * i + 7 * j
        if N == sum_C:
            flag = True
            
if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9116
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
void input(vector<int>&a,int n)
{
   rep(i,0,n-1)
   cin>>a[i];
}

void solve()
{
  int x,n; cin>>x>>n; vector<int>p(n); input(p,n);
  sort(all(p)); vector<int>v;
  rep(i,-10,101)
  {
    if(!binary_search(all(p),i)) v.eb(i);
  }
  int res=1000; int ans=-1;
  for(auto i:v)
  {
    if(abs(i-x)<res)
    {
      res=abs(i-x);
      ans=i;
    }
  }
  cout<<ans<<"\n"; return;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t=1;
  //cin>>t;
  while(t--)
  {
   solve();
  }
  return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,c,d,x=0;
    cin>>a>>b>>c>>d;
    if(a<b)
        x+=a;
    else
        x+=b;
    if(c<d)
        x+=c;
    else
        x+=d;
    cout<<x<<endl;
}

Measured memory_bytes: 256
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

ll ray[51] = {};
ll pat[51] = {};

ll burger(int n, ll k){
	//cout << n << " " << k << endl;  
	if(k <= 0) return 0;
	else if(n == 0) return 1;
	else if(k >= ray[n-1] + 2){
		return  pat[n-1] + 1 + burger(n - 1, k - 2 - ray[n-1]);
	}
	else if(k == ray[n-1] + 1){
		return  pat[n-1];
	}
	else{
		return  burger(n-1, k-1);
	}
}

int main() {
	ray[0] = 1;
	REP1(i, 50) ray[i] = ray[i-1] *2 +3;
	pat[0] = 1;
	REP1(i, 50) pat[i] = pat[i-1] *2 +1;
	int ans = 0;
	int tmp;
	int n; ll k;
	cin >> n >> k;
	cout << burger(n, k) << endl;
}

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

string s;
int x11, y11, x22, y22, x33, y33, x44, y44;
      
int main() {  
    ios::sync_with_stdio(false);
    cin >> x11 >> y11 >> x22 >> y22;

    int dx = x22 - x11;
    int dy = y22 - y11;

    x33 = x22 - dy;
    y33 = y22 + dx;

    x44 = x11 - dy;
    y44 = y11 + dx;

    cout << x33 << " " << y33 << " " << x44 << " " << y44 << endl;
  
    return 0;  
}  

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll convert(ll x, ll mod){
    if(x%mod==0){
        return 0;
    }else{
        return mod-x%mod;
    }
}

ll gcd(ll A,ll B){
    if(A<B){
        ll tmp = A;
        A = B;
        A = tmp;
    }

    ll R=A%B;
    while(R!=0){
        A=B;
        B=R;
        R=A%B;
    }
    return B;
}

int main(){
    ll A,B,C,D,N,ans;
	cin >> A >> B >> C >> D;

    //それぞれの倍数の最初の数
    ll C_mul = A+convert(A,C);
    ll D_mul = A+convert(A,D);
    ll CD_mul = A+convert(A,C*D/gcd(C,D));

    ll C_num = (B-C_mul)/C;
    ll D_num = (B-D_mul)/D;
    ll CD_num = (B-CD_mul)/((C*D)/gcd(C,D));

    if(A<=C_mul && C_mul<=B)C_num++;
    if(A<=D_mul && D_mul<=B)D_num++;
    if(A<=CD_mul && CD_mul<=B)CD_num++;

    ans = (B-A+1) - C_num - D_num + CD_num;

	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;

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

        int x = sc.nextInt();
        if(x >= 400 && x < 600){
            System.out.println(8);
        }else if(x < 800){
            System.out.println(7);
        }else if(x < 1000){
            System.out.println(6);
        }else if(x < 1200){
            System.out.println(5);
        }else if(x < 1400){
            System.out.println(4);
        }else if(x < 1600){
            System.out.println(3);
        }else if(x < 1800){
            System.out.println(2);
        }else if(x < 2000){
            System.out.println(1);
        }

    }
}


Measured memory_bytes: 35712
#include<map>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int h=0,i,j,k;
  int n;
  while(cin>>n&&n){
    if(h)
      cout<<"----------"<<endl;
    else
      h=1;
    string s;
    getline(cin,s);
    bool a[82][10002];
    memset(a,0,82*10002);
    for(i=0;i<n;i++){
      getline(cin,s);
      int ln=s.length();
      for(j=0;j<ln;j++){
	if(s[j]=='*')
	  a[j+1][i+1]=1;
      }
    }
    bool b[82][10002];
    memset(b,0,82*10002);
    map<int,int> c;
    for(i=1;i<n+1;i++){
      for(j=1;j<81;j++){
	if(a[j][i]==1&&b[j][i]==0){
	  int ulx=j,uly=i,urx=j,ury=i,dlx=j,dly=i,drx,dry;
	  for(;a[urx+1][ury]==1;urx++)
	    b[urx][ury]=1;
	  b[urx][ury]=1;
	  if(0){
	  }else if(a[ulx-1][uly+1]==1){
	    for(;a[dlx-1][dly+1]==1;){
	      b[dlx][dly]=1;
	      dlx--;
	      dly++;
	    }
	    b[dlx][dly]=1;
	  }else if(a[ulx][uly+1]==1){
	    for(;a[dlx][dly+1]==1;){
	      b[dlx][dly]=1;
	      dly++;
	    }
	    b[dlx][dly]=1;
	  }else if(a[ulx+1][uly+1]==1){
	    for(;a[dlx+1][dly+1]==1;){
	      b[dlx][dly]=1;
	      dlx++;
	      dly++;
	    }
	    b[dlx][dly]=1;
	  }
	  drx=urx;
	  dry=ury;
	  if(0){
	  }else if(a[urx+1][ury+1]==1){
	    for(;a[drx+1][dry+1]==1;){
	      b[drx][dry]=1;
	      drx++;
	      dry++;
	    }
	    b[drx][dry]=1;
	  }else if(a[urx][ury+1]==1){
	    for(;a[drx][dry+1]==1;){
	      b[drx][dry]=1;
	      dry++;
	    }
	    b[drx][dry]=1;
	  }else if(a[urx-1][ury+1]==1){
	    for(;a[drx-1][dry+1]==1;){
	      b[drx][dry]=1;
	      drx--;
	      dry++;
	    }
	    b[drx][dry]=1;
	  }
	  for(k=0;k<drx-dlx+1;k++)
	    b[dlx+k][dly]=1;
	  c[(urx-ulx+drx-dlx+2)*(dly-uly+1)/2]++;
	}
      }
    }
    map<int,int>::iterator it;
    for(it=c.begin();it!=c.end();it++)
      cout<<(*it).first<<" "<<(*it).second<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <stdio.h>
//end of libraries ;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define INF 3999999999999999999
#define N 3000003
#define PI 3.14159265359
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int k , a , b;
int main(){
fcin;
	cin >> k >> a >> b;
	for(int i = a ; i <=b ; i++){
		if(i%k==0) {cout<<"OK\n"; return 0;}
	}
	cout<<"NG\n";

}

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

vector<vector<int>> getGroups(int n) {
    vector<vector<int>> groups;
    for(int i = 1; i <= n / 2; i += 1) {
        vector<int> group = {i, n - i + 1};
        groups.push_back(group);
    }
    return groups;
}

int main() {
    int n; cin >> n;
    vector<vector<int>> groups;

    if(n % 2 == 0) {
        groups = getGroups(n);
    } else {
        groups = getGroups(n - 1);
        groups.push_back({n});
    }
    
    vector<pair<int, int>> edges;
    for(int i = 0; i < int(groups.size()); i += 1)
        for(int j = 0; j < int(groups[i].size()); j += 1) {
            for(int k = i + 1; k < int(groups.size()); k += 1) {
                for(int l = 0; l < int(groups[k].size()); l += 1) {
                    edges.push_back(make_pair(groups[i][j], groups[k][l]));
                }
            }
        }

    cout << edges.size() << "\n";
    for(auto edge : edges)
        cout << edge.first << " " << edge.second << "\n";
}

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

constexpr int lim = 1e6;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  vector<int> b(lim + 1, 1);
  b[0] = b[1] = 0;
  for (int p = 2; p * p <= lim; ++p) {
    if (b[p]) {
      for (int i = 2 * p; i <= lim; i += p) {
        b[i] = 0;
      }
    }
  }
  for (int i = 0; i < lim; ++i) {
    b[i + 1] += b[i];
  }
  int n;
  while (cin >> n, n) {
    cout << b[2 * n] - b[n] << '\n';
  }
}



Measured memory_bytes: 6688
#include<bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;


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

	freopen("output.txt", "w", stdout);
#endif

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

	ll ans = 0;
	string s, t;
	cin >> s >> t;

	for (ll i = 0; i < s.length(); i++)
	{
		if (s[i] != t[i])
		{
			ans++;
		}
	}

	cout << ans  << endl;
}

Measured memory_bytes: 3816
#include<bits/stdc++.h>
#define int   long long int  
#define pb push_back
#define BOOST ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debugL(i)  cout<<"line no-> "<<i<<" working"<<endl
#define debugVL(i,l)  cout<<"val at line no."<<i<< " ->"<<l<<endl
#define  init(st,et,val,arr) for(int i=st;i<=et;i++)arr[i]=val;
const int M=1e9 + 7;
using namespace std;
int N=200000;
int32_t main() {
	BOOST;
	string s,t;cin>>s>>t;
	int ans=0;
	if(s[0]==t[0])ans++;
	if(s[1]==t[1])ans++;
	if(s[2]==t[2])ans++;
	cout<<ans<<endl;
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/



int main(void) {
  ll i, j, k, l;
  
  ll N;
  cin >> N;
  ll a[MAX*3], b[MAX*3];
  
  for(i=1; i<=N*3; i++) cin >> a[i];
  
  priority_queue<ll> p;
  ll le[MAX]={};
  for(i=1; i<=N; i++) {
    p.push(-a[i]);
    le[0]+=a[i];
  }
  
  for(i=1; i<=N; i++) {
    p.push(-a[i+N]);
    le[i]=le[i-1];
    le[i]+=a[i+N];
    le[i]-=(-p.top()); p.pop();
  }
  
  for(i=1; i<=N*3; i++) b[i]=a[i];
  reverse(b+1, b+N*3+1);
  
  priority_queue<ll> q;
  ll ri[MAX]={};
  for(i=1; i<=N; i++) {
    q.push(b[i]);
    ri[0]+=b[i];
  }
  
  for(i=1; i<=N; i++) {
    q.push(b[i+N]);
    ri[i]=ri[i-1];
    ri[i]+=b[i+N];
    ri[i]-=q.top(); q.pop();
  }
  
  ll ans=-INF;
  for(i=0; i<=N; i++) {
    chmax(ans, le[i]-ri[N-i]);
  }
  
  pt(ans);
}



Measured memory_bytes: 8820
import math
values = input().split()
a = float(values[0])
b = float(values[1])
theta = float(values[2])
print("{:8f}".format(a * b * 0.5 * math.sin(theta * math.pi / 180.0)))
print("{:8f}".format(math.sqrt(a**2.0 + b**2.0 - 2.0*a*b*math.cos(theta * math.pi / 180.0)) + a + b))
print("{:8f}".format(b * math.sin(theta * math.pi / 180.0)))


Measured memory_bytes: 5700
def is_even(a):
    return [ai%2 == 0 for ai in a]

def extract_2(ai):
    n = 0
    while ai % 2 == 0:
        ai /= 2
        n += 1
    return n

N = int(raw_input())
a = [int(s) for s in raw_input().split()]

any_even = is_even(a)

evens = [extract_2(a[i]) for i in range(N) if any_even[i]]
print sum(evens)


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

int main(){
int n,p;
string s;
vector<tuple<string,int,int>> mise;
cin >> n;
rep(i,n){
 cin >> s >> p;
 mise.push_back( make_tuple(s,-p,i+1) );
}
sort(mise.begin(),mise.end());
rep(i,n){
 auto m = mise[i];
 int& ans = get<2>(m);
 cout << ans << endl;
}
return 0;
}

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

using namespace std;

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

    int n;
    cin>>n;

    string s =to_string(n);

    if(count(s.begin(),s.end(),'7')>0){
        cout<<"Yes\n";

    }
    else{
        cout<<"No\n";
    }


    return 0;
}


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

#define testc int t;cin>>t;while(t--)
#define endl "\n"
#define rep(i,a,b) for(int i=a;i<b;++i)
#define REP(i,a,b) for(int i=a;i<=b;++i)
#define repi(i,n) for(int i=0;i<n;++i)
#define REPI(i,n) for(int i=0;i<=n;++i)

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double
# define ull unsigned long long

# define pb push_back
# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vld vector < ld >
# define vull vector < ull >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()

# define pii pair < int , int >
# define vpii vector < pii >
# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define mod 1000000007

vvi L;

int solution(string A,string B,int m,int n){
    REPI(i,m){
        REPI(j,n){
            if(!i || !j){
                L[i][j] = 0;
                C;
            }
            if(A[i-1]==B[j-1]){
                L[i][j] = 1 + L[i-1][j-1];
            }else{
                L[i][j] = max(L[i-1][j],L[i][j-1]);
            }
        }
    }
    R L[m][n];
}

void solve(){
    string a,b;
    cin>>a>>b;
    L.resize(a.length()+1,vi(b.length()+1,-1));
    int len = solution(a,b,a.length(),b.length());
    char lcs[len+1];
    lcs[len] = '\0';
    int i = a.length(),j = b.length();
    while(i && j){
        if(a[i-1]==b[j-1]){
            lcs[len-1] = a[i-1];
            --i;--j;--len;
        }
        else if(L[i-1][j]>L[i][j-1]){
            --i;
        }else{
            --j;
        }
    }
    cout<<lcs;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

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

int main(){
  int x1,x2,y1,y2;
  int x3,x4,y3,y4;
  
  cin >> x1 >> y1 >> x2 >> y2;
  
  if(x2-x1>=0&&y2-y1>=0){
    x3 = x2 + (-1)*abs(y2-y1);
    y3 = y2 + abs(x2-x1);
    x4 = x3 + (-1)*abs(x2-x1);
    y4 = y3 + (-1)*abs(y2-y1);
  }
  else if(x2-x1<=0&&y2-y1>=0){
    x3 = x2 + (-1)*abs(y2-y1);
    y3 = y2 + (-1)*abs(x2-x1);
    x4 = x3 + abs(x2-x1);
    y4 = y3 + (-1)*abs(y2-y1);
      
  }
  else if(x2-x1<=0&&y2-y1<=0){
    x3 = x2 + abs(y2-y1);
    y3 = y2 + (-1)*abs(x2-x1);
    x4 = x3 + abs(x2-x1);
    y4 = y3 + abs(y2-y1);
  }
  else if(x2-x1>=0&&y2-y1<=0){
    x3 = x2 + abs(y2-y1);
    y3 = y2 + abs(x2-x1);
    x4 = x3 + (-1)*abs(x2-x1);
    y4 = y3 + abs(y2-y1);
  }
  
  cout << x3 << " ";
  cout << y3 << " ";
  cout << x4 << " ";
  cout << y4 << " ";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

int main(){
  	int N;
  	int x = 0, y = 0;
  	int t = 0;
  	std::cin >> N;
  	int i;
  	for (i=0;i<N;i++){
      	int t_new, x_new, y_new;
      	std::cin >> t_new >> x_new >> y_new;
      	int ds = abs(x-x_new) + abs(y-y_new);
        int dt = t_new-t;
      	if( ds > dt || ds%2 != dt%2) break; 
      	x = x_new;
      	y = y_new;
      	t = t_new;
    }
  	if(i == N) std::cout << "Yes" << std::endl;
  	else std::cout << "No" << std::endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int x;
    cin>>x;
    int a = x/500;
    int ans = a*1000;
    int r = x%500;
    ans += 5*(r/5);
    cout << ans << "\n";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=1<<18;
int t[MAX*2];
int tab[MAX],pom[MAX];
void update(int u,int v,int c)
{
	for (u+=MAX,v+=MAX;u<v;u>>=1,v>>=1)
	{
		if (u&1)t[u++]+=c;
		if (v&1)t[--v]+=c;
	}
}
void zeruj()
{
	for (int i=0;i<MAX*2;i++)t[i]=0;
}
int query(int u)
{
	int sum=0;
	for (u+=MAX;u>0;u>>=1)sum+=t[u];
	return sum;
}
int32_t main()
{
  BOOST;
	int n,k;
	cin>>n>>k;
	for (int i=1;i<=n;i++) cin>>tab[i];
	
	while (k--)
	{
		zeruj();
		for (int i=1;i<=n;i++)update(max(i-tab[i],1),min(n,i+tab[i])+1,1);
		int changes=0;
		for (int i=1;i<=n;i++)
		{
			int ile=query(i);
			if (tab[i]!=ile)changes++,tab[i]=ile;
		}
		if (!changes)break;
	}
	
	for (int i=1;i<=n;i++)cout<<tab[i]<<" ";
  return 0;
}

Measured memory_bytes: 6492
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,hantei = 0;
    cin >> n;
    string s[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(s[i] == s[j]){
                hantei = 1;
                break;
            }
        }
    }
    for(int i=1;i<n;i++){
        int x =s[i-1].length();
        if(s[i-1][x-1]!=*s[i].begin()){
            hantei = 1;
            break;
        }
    }
    if(hantei == 1) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;
 
int main(){
  int a;
  cin >>a;

  string s;
  cin >>s;

  if(a>=3200) cout << s << endl;
  else cout << "red" << endl;
}

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

using namespace std;

#define  N 222

const double PI = 3.14159265359;
typedef long long ll;

void solve() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < n; i++) {
        cout << s[i] << t[i];
    }


}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifdef qwerty
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif


    int T = 1;
    //cin >> T;
    while (T--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
stack = []
ans = S[::1]
r = 0
for c in S:
    if c == "(":
        r += 1
    if c == ")":
        if r > 0:
            r -= 1
        else:
            ans.insert(0, "(")
for _ in range(r):
    ans.append(")")
print("".join(ans))


Measured memory_bytes: 3060
s=input()
t = input()
maxi = 0

for i in range(len(s)-len(t)+1):
  count = 0
  for j in range(len(t)):
    #print(t[j], s[i+j])
    if t[j] == s[i + j]:
      count += 1
  #print(count)
  maxi = max(maxi, count)
  #print(maxi)
print(len(t)-maxi)

Measured memory_bytes: 9048
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
    int n[5];
    for (int i = 0; i < 5; i++) {
        cin >> n[i];

        if (n[i] == 0) {
            cout << i + 1;
        }
    }


    

    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d,e,f;
    cin>>a>>b>>c>>d>>e>>f;
    a*=100;
    b*=100;
    vector<vector<int>>x(f+1,vector<int>(f+1,0));//合計iグラムで、砂糖がjグラムのものはあるか
    x[0][0]=1;
    int w=a,s=0;
    for(int i=0;i<=f;i++){
        for(int j=0;j<=f;j++){
            if(x[i][j]){
                if(e*(i-j)>=100*j && j*w>i*s){
                    w=i;
                    s=j;
                }
                if(i+a<=f)x[i+a][j]=1;
                if(i+b<=f)x[i+b][j]=1;
                if(i+c<=f)x[i+c][j+c]=1;
                if(i+d<=f)x[i+d][j+d]=1;
            }
        }
    }
    cout<<w<<" "<<s<<endl;
    return 0;
}

Measured memory_bytes: 32896
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int X , Y;
int ans = 0;
int fact[1000005];
int inv[1000005];
int mod = 1000 * 1000 * 1000 + 7;
int mult(int a , int b)
{
    return a * (ll)b % mod;
}
int modPow(int a , int step)
{
    int ans = 1;
    while(step != 0)
    {
        //cout << step << endl;
        if(step & 1)
        {
            ans = mult(ans , a);
        }
        step >>= 1;
        a = mult(a , a);
    }
    return ans;
}
int c(int n , int k)
{
    return mult(fact[n] , mult(inv[k] , inv[n - k]));
}
int main() {
    fact[0] = inv[0] = 1;
    for(int i = 1; i < 1000005; i++)
    {
        fact[i] = (i * (ll)fact[i - 1]) % mod;
        inv[i] = modPow(fact[i] , mod - 2);
    }
    cin >> X >> Y;
    for(int i = 0; i <= X; i++)
    {
        int lft1 = X - i , lft2 = Y - 2 * i;
        if(lft2 < 0 || lft2 * 2 != lft1)
            continue;
        int j = lft2;
        ans += c(i + j , i);
        ans %= mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 8192