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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

int n; // n円払う
int m; // コインの種類
int c[22];
int dp[55555];

signed main() {
	cin >> n >> m;
	rep (i, m) {
		cin >> c[i];
	}

	fill(dp, dp+n+10, 1e18);
	dp[0] = 0;
		for (int j = 0; j < m; j++) {
	for (int i = 0; i <= n; i++) {
			if (i+c[j] > n) continue;
			chmin(dp[i+c[j]], dp[i] + 1);
		}
	}

	cout << dp[n] << endl;

	return 0;
}


Measured memory_bytes: 3480
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int N;
	cin>>N;
	
	cout<<(N+1)/2<<endl;
	
	return 0;
}


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

int main() {
    int N,M;cin >> N >> M;
    ll WA = 0;ll AC = 0;
    int X[M] = {};int Y[M] = {};string YY;
    for (int i = 0;i < M;i++){
        cin >> X[i];
        cin >> YY;
        if (YY == "AC") Y[i] = 0;
        else Y[i] = 1;
    }
    ll Z[N][2] = {};
    for (int i = 0;i < M;i++){
        if (Y[i] == 0) Z[X[i] - 1][1] ++;
        if (Y[i] == 1){
            if (Z[X[i] - 1][1] == 0) Z[X[i] - 1][0] ++;
        }
    }

    for (int i = 0;i < N;i++){
        if (Z[i][1] > 0) WA += Z[i][0];
        if (Z[i][1] > 0) AC++;
    }
    cout << AC << " " << WA << endl;
}

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

#define INF (INT32_MAX/2)

struct edge { int from; int to; int cost; };

edge es[5000];
int d[2500];
int pos[2500];
int N, M, P;

void shortest_path( int s )
{
	for( int i = 0; i < N; i++ ) d[i] = -INF;
	d[s] = 0;
	for( int i = 0; i < N; i++ ) {
		for( int j = 0; j < M; j++ ) {
			edge e = es[j];
			if( d[e.from] != -INF && d[e.to] < d[e.from] + e.cost ) {
				d[e.to] = d[e.from] + e.cost;
			}
		}
	}
}

void is_negative_loop( )
{
	for( int i = 0; i < N; i++ ) {
		for( int j = 0; j < M; j++ ) {
			edge e = es[j];
			if( d[e.from] != -INF && d[e.to] < d[e.from] + e.cost ) {
				pos[e.to] = 1;
			}
			if( pos[e.from] ) pos[e.to] = 1;
		}
	}
}

int main()
{
	cin >> N >> M >> P;
	for( int i = 0; i < M; i++ ) {
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		edge e;
		e.from = a;
		e.to = b;
		e.cost = c - P;
		es[i] = e;
	}

	int ans = -1;
	shortest_path( 0 );
	is_negative_loop( );
	if( pos[N - 1] == 0 ) {
		ans = max( 0, d[N - 1] );
	}

	cout << ans <<  endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <map>
#include <math.h>
#include <time.h>
#include <vector>
#include <stdarg.h>
#include <algorithm>
#include <iostream>

#define ll long long

using namespace std;

int
main() {
  int n, m;
  scanf("%d %d\n", &n, &m);

  string s;
  cin>>s;

  vector<int> pos;
  pos.push_back(n);

  int last = n;
  while (1) {
    int next = last - m;
    if (next <= 0) { 
      pos.push_back(0);
      break;
    }
    while (next < last && s[next] == '1') next++;
    if (next == last) break;

    last = next;
    pos.push_back(next);
  }

  if (pos[pos.size()-1] != 0) {
    cout<<-1<<endl;
  }
  else {
    for (int i=pos.size()-1; i>0; i--) 
      cout<<pos[i-1]-pos[i]<<" ";
    cout<<endl;
  }

  return 0;
}



Measured memory_bytes: 1144
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

class program
{
    static public int mod = 1000000007;
    static void Main()
    {
        long[] abn = longa();
        long a = abn[0], b = abn[1], n = abn[2];
        if (n < b) Write(Floor(a * n / b*1m));
        else Write(Floor(a * (b - 1) / b*1m));
    }

    static int pow(int a, int b) { string binary = Convert.ToString(b, 2); int bileng = binary.Length; long a_power = a; long value = 1; for (int i = bileng - 1; i >= 0; i--) { if (binary[i] == '1') { value = value * a_power % mod; } a_power = a_power * a_power % mod; } return (int)value; }
    static string rstr() { return ReadLine(); }
    static int rint() { return int.Parse(ReadLine()); }
    static long rlong() { return long.Parse(ReadLine()); }
    static string[] stra() { return ReadLine().Split(' '); }
    static char[] chara() { string[] a = stra(); string b = ""; for (int i = 0; i < a.Length; i++) { b += a[i]; } return b.ToCharArray(); }
    static int[] inta() { string[] read_str_array = ReadLine().Split(' '); int[] return_int_array = new int[read_str_array.Length]; for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_int_array[countup_i] = int.Parse(read_str_array[countup_i]); } return return_int_array; }
    static long[] longa() { string[] read_str_array = ReadLine().Split(' '); long[] return_long_array = new long[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_long_array[countup_i] = long.Parse(read_str_array[countup_i]); } return return_long_array; }
    static double[] doublea() { string[] read_str_array = ReadLine().Split(' '); double[] return_double_array = new double[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_double_array[countup_i] = double.Parse(read_str_array[countup_i]); } return return_double_array; }
    static long GCD(long a, long b) { if (a < b) { long temp = a; a = b; b = temp; } if (a % b == 0) { return b; } else { long temp = b; b = a % b; a = temp; return GCD(a, b); } }
    static long LCM(long a, long b) { return a * b / GCD(a, b); }
    static void WriteArray2(int[,] a, int b, int c) { for (int i = 0; i < b; i++) { for (int j = 0; j < c; j++) { if (j != 0) Write(" "); Write(a[i, j]); } WriteLine(); } }
    static void WriteArray(int[] a, int b) { for (int i = 0; i < b; i++) { Write(" "); Write(a[i]); } WriteLine(); }
}


Measured memory_bytes: 27472
#include<bits/stdc++.h>
#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define MIN3(a,b,c) (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c))
#define MAX(a,b) (a)>(b)?(a):(b)
#define MIN2(a,b) (a)<(b)?(a):(b)
using namespace std;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
#define ull unsigned long long
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;
#define deb(x )     cerr << #x << " here "<< x << endl;
#define endl    "\n"
#define printCase() "Case #" << caseNum << ": "
inline bool is_palindrome(const string& s){ return std::equal(s.begin(), s.end(), s.rbegin()); }
const ll MOD = 1000000007;
const ll INF = 1e9+10;
const double eps = 1e-9;
const double PI = acos(-1.0);
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
#define ff first
#define ss second
/*----------------------------------------------------------------------*/

const int N = 2e5+5;
set<int> blocked;
vector<iii> events;

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

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,d,q,s,t,x; cin>>n>>q;
    FOR(i, 0, n) {
    	cin>>s>>t>>x;
    	events.push_back({s - x, {1, x}});
    	events.push_back({t - x, {-1, x}});
    }
    sort(events.begin(), events.end());
    int idx = 0;
    FOR(i, 0, q) {
    	cin>>d;
    	while(idx < events.size() && events[idx].ff <= d) {
    		int xx = events[idx].ss.ss;
    		if(events[idx].ss.ff == 1) {
    			blocked.insert(xx);
    		} else {
    			auto itr = blocked.find(xx);
    			blocked.erase(itr);
    		}
    		idx++;
    	}
    	if(blocked.empty()) {
    		cout<<-1<<endl;
    	} else {
    		cout<<*blocked.begin()<<endl;
    	}
    }

    return 0;
}

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

#define int long long int
#define vi vector<int>
#define vvi vector<vi>
#define read(a)  for(int i = 0; i < n; i++) cin >> a[i];
#define print(a)  for(int i = 0; i < n; i++) cout << a[i] << " ";
#define pb push_back
#define ins insert
#define pql priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define pqlv priority_queue<vi>
#define pqsv priority_queue<vi, vvi, greater<vi>>
#define endl '\n'

signed main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    ans += min(k, a);
    k -= min(k, a);
    if(k) {
        k -= min(k, b);
    }
    if(k) {
        ans -= min(k, c);
        k -= min(k, c);
    }
    cout << ans;
}

Measured memory_bytes: 3624
package main

import (
	"fmt"
)

func main() {
  var n int
  fmt.Scan(&n)

  var matched int
 
  p := make([]int, n)
  for i := range p {
    fmt.Scan(&p[i])
  }

  for i := 1; i +1 < n; i++ {
    if p[i + 1] > p[i] && p[i] > p[i - 1] {
      matched++
    } else if p[i - 1] > p[i] && p[i] > p[i + 1] {
      matched++
    }
  }
  fmt.Println(matched)
}

Measured memory_bytes: 512
#include <iostream>
#include <climits>
const int VMAX = 100001;

int main() {
  int n,w;
  std::cin >> n >> w;
  long long dp[VMAX];
  long long dpn[VMAX];
  for (int i=0; i<VMAX; i++){
    dp[i] = LLONG_MAX / 2;
    dpn[i] = LLONG_MAX / 2;
  }
  
  long long nw;
  long long nv;

  dp[0] = 0;
  for(int i=0; i<n; i++){
    std::cin >> nw >> nv;
    for(int j=0; j<VMAX; j++){
      dpn[j] = dp[j];
      if (j >= nv)
        dpn[j] = std::min(dpn[j], dp[j-nv]+nw);
    }
    for(int j=0;j<VMAX;j++)
      dp[j] = dpn[j];
  }
  long long ans = 0;
  for(int i=0; i<VMAX; i++){
    if (dp[i] <= w)
      ans = i;
  }
  
  std::cout << ans << std::endl;
}

Measured memory_bytes: 5196
import sys
input=sys.stdin.readline

def main():
    n,m=map(int,input().split())
    Edges=[[] for _ in range(n)]
    for _ in range(m):
        s,t=map(int,input().split())
        s-=1; t-=1
        Edges[s].append(t)
    DP=[0]*n
    for v in reversed(range(n-1)):
        tmp=0
        for to in Edges[v]:
            tmp+=DP[to]
        DP[v]=tmp/len(Edges[v])+1
    ans=DP[0]
    for v in range(n-1):
        if len(Edges[v])==1:
            continue
        u=max((DP[to],to) for to in Edges[v])[1]
        DP2=[0]*n
        for w in reversed(range(n-1)):
            tmp=0
            for to in Edges[w]:
                if w==v and to==u:
                    continue
                tmp+=DP2[to]
            if w==v:
                DP2[w]=tmp/(len(Edges[w])-1)+1
            else:
                DP2[w]=tmp/len(Edges[w])+1
        ans=min(ans,DP2[0])
    print(ans)

if __name__=='__main__':
    main()

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


int N;
int main(){

    cin >> N;

    const int MAX_V = 30000;
    
    queue<int> two_mpl;
    queue<int> three_mpl;
    queue<int> six_mpl;
    for(int i = 1; i <= MAX_V; i++){
        if(i % 2 == 0 && i % 6 != 0){
            two_mpl.push(i);
        }
        else if(i % 3 == 0 && i % 6 != 0){
            three_mpl.push(i);
        }
        else if(i % 6 == 0){
            six_mpl.push(i);
        }
    }


    if(N == 3){
        cout << "2 5 63" << endl;
    }
    else{
        vector<int> ans;
        N -= 2;
        ans.push_back(two_mpl.front()); two_mpl.pop();
        ans.push_back(two_mpl.front()); two_mpl.pop();
        N -= 2;
        ans.push_back(three_mpl.front()); three_mpl.pop();
        ans.push_back(three_mpl.front()); three_mpl.pop();

        while(N > 1){
            if(two_mpl.size()){
                N -= 2;
                ans.push_back(two_mpl.front()); two_mpl.pop();
                ans.push_back(two_mpl.front()); two_mpl.pop();
            }
            else if(three_mpl.size()){
                N -= 2;
                ans.push_back(three_mpl.front()); three_mpl.pop();
                ans.push_back(three_mpl.front()); three_mpl.pop();
            }
            else{
                N -= 2;
                ans.push_back(six_mpl.front()); six_mpl.pop();
                ans.push_back(six_mpl.front()); six_mpl.pop();
            }
        }
        if(N == 1){
            ans.push_back(six_mpl.front()); six_mpl.pop();
        }
        for(int a : ans){
            cout << a << " ";
        }
        cout << endl;
    }
    

    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main{ // Main
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Set<Integer> fixed = new HashSet<>();
		int free = 0;
		for(int i = 0; i < n; i ++) {
			int a = scanner.nextInt();
			if(a / 400 < 8) {
				fixed.add(a / 400);
			} else {
				free ++;
			}
		}
		int min = 0;
		int max = 0;
		if(fixed.isEmpty()) {
			min = 1;
			max = free;
		} else {
			min = fixed.size();
			max = min + free;			
		}
		System.out.println(min + " " + max);
		
		scanner.close();
	}
}

Measured memory_bytes: 21844
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

nums = defaultdict(int)
for a in A:
    nums[a] += 1

total = 0
for k, v in nums.items():
    total += v * (v - 1) // 2

for a in A:
    v = nums[a]
    diff = v * (v - 1) // 2 - (v - 1) * (v - 2) // 2
    print(total - diff)

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

int main()
{
    int n;
    cin >> n ;
    vector<int> d(n);
    for(int i=0;i<n;i++){
        cin>>d.at(i);
    }
    int count=0;
    sort(d.begin(),d.end());
    for(int i=0;i<n-1;i++){
        if(d.at(i)==d.at(i+1)){
            count++;
        }

    }


    
    cout <<n-count << endl;
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            boolean[] ar = new boolean[100001];
            for (int i = 0; i < n; i++) {
                int l = in.nextInt();
                int r = in.nextInt();
                for (int j = l; j <= r; j++) {
                    ar[j] = true;
                }
            }
            int ans = 0;
            for (int i = 1; i <= 100000; i++) {
                if (ar[i])
                    ans++;
            }
            out.println(ans);
        }

    }

    static class InputReader {
        StringTokenizer st;
        BufferedReader br;

        public InputReader(InputStream is) {
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            this.br = br;
        }

        public String next() {
            if (st == null || !st.hasMoreTokens()) {
                String nextLine = null;
                try {
                    nextLine = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (nextLine == null)
                    return null;
                st = new StringTokenizer(nextLine);
            }
            return st.nextToken();
        }

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

    }
}



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

map<int, ll> f;

int main(){
	ll x;
	cin >> x;

	for(int a=-118; a<=119; a++){
		for(int b=-119; b<=118; b++){
			if(pow(a, 5) - pow(b, 5) == x){
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}

	return 0;
}


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

int main(void){
  int a,b,c;
  cin>>a>>b>>c;
  int k;
  cin >> k;
  int M = max(c,max(a,b));
  int s = a+b+c-M;
  REP(i, k)M *= 2;
  cout << s+M <<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;
//a[?] < b[?] < c[?]
int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];
    sort(all(a));
    sort(all(b));
    sort(all(c));
    ll ans = 0;
    rep(i,n){
        ll A = (lower_bound(all(a), b[i]))-a.begin();
        ll C =  n-((upper_bound(all(c), b[i]))-c.begin());
        ans += A*C;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int Mod = 1e9 + 7;

const int maxn = 410;

int n;
int a[maxn + 5], b[maxn + 5];

int dp[2][maxn + 5][maxn + 5][2];

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	REP(i, 0, n) scanf("%d", a + i), --a[i];
	REP(i, 0, n) scanf("%d", b + i), --b[i];
	if (a[0] == b[0])
	{
		printf("0\n");
		return 0;
	}
	dp[0][0][0][0] = 1;
	static bool visa[maxn + 5];
	static bool visb[maxn + 5];
	memset(visa, 0, sizeof visa);
	REP(i, 0, n + 1) 
	{
		int cur = i & 1, nxt = !cur;
		memset(dp[nxt], 0, sizeof dp[nxt]);
		memset(visb, 0, sizeof visb);
		REP(j, 0, n + 1) 
		{
			REP(k, 0, n + 1) REP(l, 0, 2) if (dp[cur][j][k][l])
			{
				if (l == 0)
				{
					if (i < n && visb[a[i]]) (dp[nxt][j][k][l] += dp[cur][j][k][l]) %= Mod;
					else
					{
						if (i < n && k) (dp[nxt][j][k - 1][l] += (LL)k * dp[cur][j][k][l] % Mod) %= Mod;
						(dp[cur][j][k][1] += dp[cur][j][k][l]) %= Mod;
					}
				}
				else
				{
					if (j < n && visa[b[j]]) (dp[cur][j + 1][k][l] += dp[cur][j][k][l]) %= Mod;
					else
					{
						if (i < n && j < n && a[i] == b[j]) continue;
						if (j < n && k) 
						{
							(dp[cur][j + 1][k - 1][l] += (LL)k * dp[cur][j][k][l] % Mod) %= Mod;
						}
						if (i < n && j < n && a[i] != b[j])
						{
							(dp[nxt][j + 1][k + 1][0] += dp[cur][j][k][l]) %= Mod;
						}
					}
				}
			}
			if (j < n) visb[b[j]] = 1;
		}
		if (i < n) visa[a[i]] = 1;
	}
	int m = n / 3;
	int ans = dp[n & 1][n][0][1];
	int cnt = 0;
	REP(i, 0, m)
	{
		ans = (LL)ans * (cnt + 1) % Mod;
		ans = (LL)ans * (cnt + 2) % Mod;
		cnt += 3;
	}
	(ans += Mod) %= Mod;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2944
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {
    vector<int> v;
    v.resize(27);
    fill(v.begin(), v.end(), 0);
    v['A' - 'A'] = 'T';
    v['T' - 'A'] = 'A';
    v['C' - 'A'] = 'G';
    v['G' - 'A'] = 'C';
    char s;
    cin >> s;
    cout << char(v[s - 'A']) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Linq;
class P
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        int[] a = new int[3];
        a[0] = int.Parse(s[0]);
        a[1] = int.Parse(s[1]);
        a[2] = int.Parse(s[2]);
        Array.Sort(a);
        Console.WriteLine(a[2] - a[0]);
    }
}

Measured memory_bytes: 13140
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array

main :: IO ()
main = do
  (n:m:c:_) <- fmap (map read . words) getLine :: IO [Int]
  bs <- fmap (map read . words) getLine :: IO [Int]
  am <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  print $ solve c bs am

solve c bs am = length $ filter (\as -> c + sum (zipWith (*) as bs) > 0) am 

Measured memory_bytes: 1020
import math
k = int(input())
dec = {}

for a in range(1, k+1):
    for b in range(1, k+1):
        if math.gcd(a, b) not in dec:
            dec[math.gcd(a,b)] = 1
        else:
            dec[math.gcd(a,b)] += 1
ans = 0
for c in range(1, k+1):
    for d in dec.keys():
        ans += math.gcd(d, c) * dec[d]
print(ans)

Measured memory_bytes: 65856
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    int Q; cin >> Q;
    priority_queue<ll,vector<ll>,greater<ll>> que_l;
    priority_queue<ll> que_s;
    ll sum_l=0, sum_s=0;
    ll b_sum=0;
    REP(i,Q){
        int q; cin >> q;
        if (q==1){
            ll a, b; cin >> a >> b;
            b_sum += b;
            if (que_s.empty() || a<=que_s.top()) {
                que_s.push(a); sum_s += a;
                if ((int)que_l.size()+1<(int)que_s.size()){
                  ll ps = que_s.top();
                    que_s.pop(); sum_s -= ps;
                    que_l.push(ps); sum_l += ps;
                }
            }else{
                que_l.push(a); sum_l += a;
                if((int)que_l.size()>(int)que_s.size()){
                  ll pl = que_l.top();
                    que_l.pop(); sum_l -= pl;
                    que_s.push(pl); sum_s += pl; 
                }
            }
        }else{
            ll nl = que_l.size(), ns = que_s.size();
            ll med = que_s.top();
          cout << med << " ";
            cout << sum_l - nl * med + ns * med - sum_s + b_sum << endl;
        }
    }
    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
vector<int> children[100500];
list<int> path;
bool visited[100500];

void visit1(int from)
{
    bool checker = true;
    int to;
    for(int i = 0; i < children[from].size(); i++){
        if(visited[children[from][i]] == false){
            checker = false;
            to = children[from][i];
            break;
        }
    }
    if(checker){
        return;
    }
    path.push_back(to);
    visited[to] = true;
    visit1(to);
}
void visit2(int from)
{
    bool checker = true;
    int to;
    for(int i = 0; i < children[from].size(); i++){
        if(visited[children[from][i]] == false){
            checker = false;
            to = children[from][i];
            break;
        }
    }
    if(checker){
        return;
    }
    path.push_front(to);
    visited[to] = true;
    visit2(to);
}


int main() {
    //cout.precision(10);
    int n, m;
    cin >> n >> m;
    for(int i = 2; i <= n; i++){
        visited[i] = false;
    }
    visited[1] = true;
    path.push_back(1);
    for(int i = 1; i <= m; i++){
        int a, b;
        cin >> a >> b;
        children[a].push_back(b);
        children[b].push_back(a);
    }
    visit1(1);
    visit2(1);
    cout << path.size() << endl;
    for(auto itr = path.begin(); itr != path.end(); ++itr){
        cout << *itr << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 9472
#define dbg(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#define dpri(x) dbg(#x ": %d\n", x)
#define dprs(x) dbg(#x ": %s\n", x)
#include <stdio.h>
const int INF = 1e9+7;

int main(int argc, char **argv)
{
	int H, W, i, j;
	for (;;) {
		scanf("%d %d", &H, &W);
		if (H == 0 && W == 0) break;
		for (i = 0; i < H; i++) {
			for (j = 0; j < W; j++) {
				if (i == 0 || i+1 == H || j == 0 || j+1 == W) {
					putchar('#');
				} else {
					putchar('.');
				}
			}
			putchar('\n');
		}
		putchar('\n');
	}

	return 0;
}

Measured memory_bytes: 1000
#include<bits/stdc++.h>
using namespace std;
#define i64 long long int
int n,k;
pair<i64,int> a[1111];int top;
void pus(i64 x){
	int r = 0;
	for(i64 y = x; y; y/=10)
		r += y%10;
	while(top > 0 && a[top-1].first * r > a[top-1].second * x)
		--top;
	a[top++] = make_pair(x,r);
}
int main(){
	for(int i=1; i<1000000; i++){
		pus(i);
	}
	i64 cur = 10;
	for(int k=7; k<=15; k++,cur*=10){
		for(int i=100000; i<1000000; i++)
			pus((i+1)*cur-1);
	}
//	k=top;
	scanf("%d",&k);
	for(int i=0; i<k; i++)
		printf("%lld\n",a[i].first);
	return 0;
}


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

int main(){
    size_t N;
    unsigned long A, B, X;
    cin >> N >> A >> B >> X;
    unsigned long ans{0};
    for(unsigned long i = 1, x; i < N; ++i){
        cin >> x;
        ans += min((x - X) * A, B);
        X = x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(a-c)<=d)cout<<"Yes"<<endl;
	else if(abs(a-b)>d||abs(c-b)>d)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}


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



int main(){
  ios_base::sync_with_stdio(false);

  int n,k;
  int now = 1;

  cin >> n >> k;

  while(n > 0){
    if(now *2 < now + k){
      now = now * 2;
    } else {
      now += k;
    }
    n--;
  }

  cout << now << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
#define ll long long
using namespace std;

int main() {
    int n;
    cin>>n;
    cout<<(1000-n%1000)%1000<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(){
	int n,k,q,c;
	cin>>n>>k>>q;
	int p[n]{};
	for(int i=0;i<q;i++){
		cin>>c;
		p[c-1]++;
	}
	for(int i=0;i<n;i++){
		p[i]-=(q-k);
		cout<<(p[i]>0?"Yes":"No")<<endl;
	}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a,k) distance((v).begin(),(k)+upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a,k) distance((v).begin(),(k)+lower_bound((v).begin(),(v).end(),(a)))
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vp;
inline int getInt() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MX = 200005;
#define M 1000000007
//---------------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)

//--------------------------------------------------------------

void Main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  vi w(n,0);
  vi b(n,0);
  if(s.front()=='#') b[0  ]++;
  if(s.back()=='.')  w[n-1]++;
  rep(i,n-1){
    if(s[i+1]=='#') b[i+1]=b[i]+1;
    else b[i+1] = b[i];
  }
  drep(i,n-1){
    if(s[i]=='.') w[i]=w[i+1]+1;
    else w[i] = w[i+1];
  }
  int ans=INF;
  rep(i,n-1){
    mins(ans,b[i]+w[i+1]);
  }
  cout<<mins(ans,min(w[0],b[n-1]))<<endl;
} int main(int argc,char** argv)
{fastio; myio; myloopset Main();}


Measured memory_bytes: 2196
/**
 *    author:  nasimnoob
**/

#include<bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

//----------------------------------------------------------//

typedef long long                       ll;
typedef unsigned long long              ull;
typedef long double                     ld;

//-----------------------------------------------------------//

#define      cube(x)                    (x*x*x)
#define      sqr(x)                     (x*x)
#define      PI                         acos(-1)

//-----------------------------------------------------------//

int main()
{
    //string ;
    int k,a,b,c=0;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++)
    {
        if(i%k==0)
            c++;
    }
    if(c>0)
         cout<<"OK"<<endl;
    else
       cout<<"NG"<<endl;
    return 0;
}




Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int i;
  string s;
  cin >> s;
  for (i=0;i<3;i++) if (s.at(i)==s.at(i+1)) break;
  if (i==3) cout << "Good" << endl;
  else cout << "Bad" << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    n,k = map(int,input().split())
    a = []
    for _ in range(n):
        a.append(int(input()))

    def check(P):
        s = 0
        res = 1
        for b in a:
            if P<b:return False
            if P<s+b:
                s = b
                res+=1
            else :s+=b
        return k>=res

    l,r = 0,1000000007
    m = 0
    while l<r-1:
        m = (l+r)//2
        if check(m):r = m
        else       :l = m
    print(r)



if __name__ == '__main__':
    main()




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

using namespace std;
using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  int64 N;
  cin >> N;
  vector< int64 > X(N), Y(N);
  vector< char > D(N);
  for(int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i] >> D[i];
  }

  auto check = [&](long double v) {
    long double a = 1e18, b = 1e18, c = -1e18, d = -1e18;
    for(int i = 0; i < N; i++) {
      long double x = X[i], y = Y[i];
      if(D[i] == 'R') x += v;
      else if(D[i] == 'L') x -= v;
      else if(D[i] == 'U') y += v;
      else y -= v;
      chmin(a, x);
      chmin(b, y);
      chmax(c, x);
      chmax(d, y);
    }
    return (c - a) * (d - b);
  };
  double l = 0, r = 1e18;
  for(int i = 0; i < 300; i++) {
    double p = (l * 2 + r) / 3;
    double q = (l + 2 * r) / 3;
    if(check(p) < check(q)) r = q;
    else l = p;
  }
  cout << check(l) << endl;
}



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

int main(void){
    int n, t, a[100005];
    cin >> n >> t;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    int mi=a[0], ma=0, cnt=0;
    for(int i=1; i<n; i++){
        int tmp = a[i] - mi;
        if(ma == tmp){
            cnt++;
        }else if(ma < tmp){
            ma = tmp;
            // cout << ma << endl;
            cnt = 0;
        }
        if(mi > a[i]){
            mi = a[i];
        }
    }
    cout << cnt+1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    string s,t;
    cin >> s >> t;
    int n = s.size();
    vector<vector<int>> a(26);
    rep(i,n){
        int c = s[i] - 'a';
        a[c].push_back(i);
    }
    ll ans = 0;
    ll cur = -1;
    for(int i=0;i<t.size();i++){
        // t の i 文字目について最初に出現する位置を調べる
        int c = t[i] - 'a';
        if(a[c].size()==0){
            cout << -1 << endl;
            return 0;
        }else{
            // cur より右にcが存在したらそこを使う
            // 無かったら左に出てくる最初のやつを使う
            int p = upper_bound(ALL(a[c]),cur) - a[c].begin();
            if(p==a[c].size()){
                // 右に存在しないので
                ans += n - cur;
                ans += a[c][0];
                cur = a[c][0];
            }else{
                // 右に存在する
                ans += a[c][p] - cur;
                cur = a[c][p];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1228
import sys;sys.setrecursionlimit(6**8);I=lambda:map(int,input().split());n,=I();G=[[]for i in[0]*-~n]
for i in[0]*~-n:a,b,c=I();G[a]+=(b,c),;G[b]+=(a,c),
q,k=I()
def f(v,p,u):
 for t,c in G[v]:p==t or f(t,v,u+c)
 G[v]=u
f(k,0,0)
for p in[0]*q:x,y=I();print(G[x]+G[y])

Measured memory_bytes: 130080
N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

counts = [sum((a >> i) & 1 for a in A) for i in range(60)]

power2 = [1]
for _ in range(59):
    power2.append((power2[-1] * 2) % MOD)

ans = sum(c * (N - c) * power2[i] for i, c in enumerate(counts))

print(ans % MOD)


Measured memory_bytes: 122808
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let v = read_vec::<u32>();
    let p = v[0];
    let q = v[1];
    let r = v[2];

    let v2 = vec![p+q, q+r, r+p];
    let ans = v2.iter().min().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define INF 1e9
#define pb push_back
#define mp  make_pair
#define loop(a,n) for(long long i=a;i<n;i++)
#define vil vector<long long int>
#define vi vector<int>
#define sz(v) v.size()
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
bool isperfect(ll n){
    ll y=sqrt(n);
    if(n%y==0&&y*y==n)return true;
    return false;
}
bool comp(pair<ll,ll> a,pair<ll,ll> b){
    return a.second<b.second;
}


int main() {
  int n,k;cin>>n>>k;
  set<int> s;
  while(k--){
      int x;cin>>x;
      while(x--){
          int y;cin>>y;
          s.insert(y);
      }
  }
  cout<<n-s.size();
}



Measured memory_bytes: 3692
#include<stdio.h>
#include<math.h>

typedef struct{
  double x,y;
}point;

void kock(int n,point p1,point p2){
  point s,t,u;
  double k=60.0*(acos(-1)/180.0);
  if(n==0) return;
  s.x=(2.0*p1.x+p2.x)/3.0;
  s.y=(2.0*p1.y+p2.y)/3.0;
  t.x=(p1.x+2.0*p2.x)/3.0;
  t.y=(p1.y+2.0*p2.y)/3.0;
  u.x=(t.x-s.x)*cos(k)-(t.y-s.y)*sin(k)+s.x;
  u.y=(t.x-s.x)*sin(k)+(t.y-s.y)*cos(k)+s.y;
  kock(n-1,p1,s);
  printf("%.8f %.8f\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  kock(n-1,t,p2);
}
  

int main(){
  int n;
  point p1,p2;
  scanf("%d",&n);
  p1.x=0;
  p1.y=0;
  p2.x=100;
  p2.y=0;
  printf("%.8f %.8f\n",p1.x,p1.y);
  kock(n,p1,p2);
  printf("%.8f %.8f\n",p2.x,p2.y);

  return 0;
}



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

int main()
{
  string S, T;
  cin >> S >> T;
  int LEN = S.length();

  for (int i = 0; i < LEN; i++)
  {

    char L = S[S.size() - 1];
    S = L + S;
    S.pop_back();

    if (S == T)
    {
      cout << "Yes" << endl;
      exit(0);
    }
    // char s = S[0];
    // S.erase(0, 1);
    // int idx2 = T.find_first_of(s);
    // if (idx2 >= 0)
    // {
    //   T.erase(idx2, 1);
    // }
    // else
    // {
    //   cout << "No" << endl;
    //   exit(0);
    // }
  }
  // cout << "Yes" << endl;
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

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

	string str;cin >> str;
	REP(i, str.size()){
		if(str[i] == '7'){
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int a,b,c;cin>>a>>b>>c;
    if(a%b==0){
        cout<<"NO"<<endl;
        return 0;
    }
    rep(i,b){
        int aa=a*i;
        if(aa%b==c){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;

  map<P, int> mp;
  rep(i, 1, n + 1) {
    string s = to_string(i);
    mp[make_pair(s[0]-'0',s[s.size() - 1] - '0')]++;
  }

  ll ans = 0;
  rep (i, 1, n + 1){
    string s = to_string(i);
    P p = make_pair(s[s.size() - 1] - '0', s[0]-'0');
    ans += mp[p];
  }

  cout << ans << endl;
}


Measured memory_bytes: 3716
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  int h[n];
  int c =0 ;
  for(int i=0 ;i <n; ++i){
    cin >> h[i];
    if(h[i]>=k) c++;
  }
  
  printf("%d\n", c);
  return 0;
}

Measured memory_bytes: 640
H,W = map(int,input().split())
src = [input() for i in range(H)]

ans = []
for row in src:
    ans.append(list(row))

for i in range(H):
    for j in range(W):
        if src[i][j] == '#': continue
        c = 0
        if i > 0:
            if j > 0 and src[i-1][j-1] == '#': c += 1
            if src[i-1][j] == '#': c += 1
            if j < W-1 and src[i-1][j+1] == '#': c += 1
        if j > 0 and src[i][j-1] == '#': c += 1
        if j < W-1 and src[i][j+1] == '#': c += 1
        if i < H-1:
            if j > 0 and src[i+1][j-1] == '#': c += 1
            if src[i+1][j] == '#': c += 1
            if j < W-1 and src[i+1][j+1] == '#': c += 1
        ans[i][j] = c

for row in ans:
    print(''.join(list(map(str,row))))


Measured memory_bytes: 3064
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		DecimalFormat df1 = new DecimalFormat("0.########");
		int a = sc.nextInt();
		int b = sc.nextInt();
		int C = sc.nextInt();
		double S = 0;
		double L = 0;
		double H = 0;
		double z;
		if(C == 90){
			H = b;
			S = a * b / 2;
			z = Math.sqrt(a * a + b * b);
			L = a + b + z;
		}
		else{
			double sinθ = Math.sin(Math.toRadians(C));
			double cosθ = Math.cos(Math.toRadians(C));
			S = a * b / 2 * sinθ;
			H = b * sinθ;
			z = Math.sqrt(a * a + b * b - 2 * a * b * cosθ);
			L = a + b + z;

			
		}
		System.out.println(df1.format(S));
		System.out.println(df1.format(L));
		System.out.println(df1.format(H));
		
	}
}


Measured memory_bytes: 26308
#include <iostream>

using namespace std;
long long n,k,i,b,tmp = 0;

long long process(int b, int k) {
	if (b <= k) return n;
	else return (n/b*k) + ((n % b < k) ? (n % b + 1) : k) - 1;
}

main () {
	cin >> n >> k;
	for (b = 1; b <= n; b++) tmp += process(b,k);
	if (!k) tmp = 0;
	cout << n*n - tmp;
}

Measured memory_bytes: 256
#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 main() {
  int h, w, k;
  cin >> h >> w >> k;
  char c[10][10];
  rep(i,h)rep(j,w) cin >> c[i][j];
  int ans = 0;
  rep(bi, 1<<h)rep(bj, 1<<w) {
    int cnt = 0;
    rep(i,h)rep(j,w) {
      if (bi>>i & 1) continue;
      if (bj>>j & 1) continue;
      if (c[i][j] == '#') cnt++;
    }
    if (cnt == k) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;

    // ランレングス圧縮
    int n = sz(s);
    vector<pair<char, int>> cnt;
    cnt.emplace_back(s[0], 0);
    rep(i, n) {
        if (cnt.back().fi == s[i]) cnt.back().se++;
        else cnt.emplace_back(s[i], 1);
    }

    // 移動をx成分とy成分に分ける（初めのFは別で処理）
    int sx = 0, sy = 0;
    vector<int> xlist, ylist;
    int now = 0;
    rep(i, sz(cnt)) {
        if (i == 0 && cnt[i].fi == 'F') {
            sx += cnt[i].se;
        } else if (cnt[i].fi == 'T') {
            now ^= (cnt[i].se % 2);
        } else {
            if (now == 0) xlist.push_back(cnt[i].se);
            else ylist.push_back(cnt[i].se);
        }
    }

    // どこに移動できるかDP（10000を0としている）
    vector<bool> to_x(40000, false);
    vector<bool> to_y(40000, false);
    to_x[20000] = true;
    to_y[20000] = true;

    rep(i, sz(xlist)) {
        vector<bool> pre_x(40000, false);
        swap(to_x, pre_x);
        rep(j, 40000) if (pre_x[j]) {
            to_x[j + xlist[i]] = true;
            to_x[j - xlist[i]] = true;
        }
    }

    rep(i, sz(ylist)) {
        vector<bool> pre_y(40000, false);
        swap(to_y, pre_y);
        rep(j, 40000) if (pre_y[j]) {
            to_y[j + ylist[i]] = true;
            to_y[j - ylist[i]] = true;
        }        
    }

    // 移動できるかチェック
    int dx = x - sx, dy = y - sy;
    dx += 20000, dy += 20000;
    if (to_x[dx] && to_y[dy]) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 3700