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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;

    B = abs(B - A);
    ll u = D * (N - 1);
    ll d = C * (N - 1);
    REP(i, N) {
        if (d <= B && B <= u) {
            cout << "YES" << endl;
            return 0;
        }
        u -= (C + D);
        d -= (C + D);
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    ll ans = 0;
    vector<ll> a(n), b(n);
    for(int i=0;i<n;i++) cin >> a[i] >> b[i];

    ll s=0;
    ll sum = 0;
    for(int i=n-1;i>=0;i--) {
        int temp = ceil(double(a[i]+s)/b[i])*b[i]-(a[i]+s);
        s += temp;
        sum += temp;
    }
    cout << sum << endl;

}


Measured memory_bytes: 1920
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>



int main(int argc, char* argv[])
{
	using std::cin;
	using std::cout;
	std::ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int N, A, B;
	cin >> N >> A >> B;
	cout << std::min(N*A, B) << std::endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(float,input().split()))

dp = [[0 for _ in range(n+1)] for _ in range(n+1)]
dp[0][0] = 1
for i in range(n):
    for j in range(n):
        dp[i+1][j+1] += dp[i][j]*p[i]
        dp[i+1][j] += dp[i][j]*(1-p[i])
res = 0
for j in range((n+1)//2,n+1):
    res += dp[n][j]
print(res)

    

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


int main(){

	int N,M;
	cin>>N>>M;
	
	dsu D(N);
	
	rep(i,M){
		int u,v;
		cin>>u>>v;
		u--;v--;
		D.merge(u,v);
	}
	
	int cnt = 0;
	
	rep(i,N){
		if(D.leader(i)==i)cnt++;
	}
	
	cout<<cnt-1<<endl;

	return 0;
}


Measured memory_bytes: 3788
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int s,k;
  cin >> k >> s;
  int cnt=0;
  rep(x,k+1){
    rep(y,k+1){
      int z = s-(x+y);
      if(0<=z&&z<=k){
	cnt++;
      }
    }
  }
  cout << cnt << "\n";
  return 0;
}


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

ll calc(ll n,ll a,ll b){
	return n-(n/a+n/b-n/(a/__gcd(a,b)*b));
}
int main(){
	ll a,b,c,d;cin>>a>>b>>c>>d;
	cout<<calc(b,c,d)-calc(a-1,c,d)<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
	int n,n1,n2,count,a;
	while(scanf("%d%d",&n1,&n2)!=EOF){
		count=0;
		a=n1+n2;
		while(a!=0){
			a=a/10;
			count++;
		}
	printf("%d\n",count);
	}
	return 0;
}


Measured memory_bytes: 2548
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

long waru2(long a){
	long res = 0;
	while(a%2 == 0){
		res++;
		a /= 2;
	}
	return res;
}

long max(long a,long b){
	if(a > b)return a;
	else return b;
}

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

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

long lcm(int a,int b){
	long ma = max(a,b);
	long mi = min(a,b);
	return ma * mi / gcd(ma,mi);
}

int main(){
	long n,m;
	cin >> n >> m;
	vector<long> a(n);
	bool flag = true;
	long c = 0;
	for(int i=0;i<n;++i){
		cin >> a[i];
		if(i == 0){
			c = waru2(a[i]);
		}else if(c != waru2(a[i])){
			flag = false;
		}
		a[i] /= 2;
	}
	long key = a[0];
	for(int i=1;i<a.size();++i){
		key = lcm(key,a[i]);
	}
	long res;
	if(flag){
		res = m/key;
		res = res/2 + (res%2);
	}else{
		res = 0;
	}
	cout <<  res << endl;
}

Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: f64 = read();
    let b: f64 = read();
    let x: f64 = read();

    //台形
    if a * a * b < 2.0 * x {
        let p = ((2.0 * x) / (a * a)) - b;
        let d = ((a * a) + (b - p) * (b - p)).sqrt();
        let rad = (a / d).acos();
        let deg = rad.to_degrees();
        println!("{}", deg);
    //三角形
    } else {
        let d = (2.0 * x) / (a * b);
        let y = d / (b * b + d * d).sqrt();
        let rad = y.acos();
        let deg = rad.to_degrees();
        println!("{}", deg);
    }
}


Measured memory_bytes: 4352
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n = I()
        if n == 0:
            break

        a = [S() for _ in range(n)]
        b = []
        for s in a:
            t = s[0]
            for i in range(len(s)-1):
                if s[i] in 'aiueo':
                    t += s[i+1]
            b.append(t)
        r = -1
        for k in range(1,51):
            s = set()
            f = True
            for t in b:
                if t[:k] in s:
                    f = False
                    break
                s.add(t[:k])
            if f:
                r = k
                break

        rr.append(r)


    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 9060
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
  ll a,b;
  cin>>a>>b;
  if(a<b)
  {
    for(int i=1;i<=b;i++)
        cout<<a;
  }
  else{  
  for(int i=1;i<=a;i++)
        cout<<b;
}
}
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long
#define W V<L>
#define R(n)for(L i;i<n;i++)
L E=70;W S(V<W>p){if(!E){return{1,0};}V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1){T[(x[1]+1)&1].push_back({x[0]/2,(x[1]+1)/2});}}R(2){L c=0;for(W x:T[!i]){L Q=(2*x[0]+x[1])%3;c^=Q+1;}if(!c){E--;W A=S(T[i]);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p){v[0]++;}W A=S(p);A[0]--;return A;}int main(){L M=2e17,n,a,b;cin>>n;V<W>p(n);R(n){cin>>a>>b;p[i]={a+M,b+M};}W x=S(p);cout<<x[0]-M<<" "<<x[1]-M;}

Measured memory_bytes: 62908
#include <bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define sz(x) (int)x.size()
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define itn int
#define vpii vector<pii>
#define pdd pair<double,double>
#define vll vector<ll>

typedef long long ll;

using namespace std;

int dp[1 << 12];

const int INF = 1e9;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	fill(dp, dp + (1 << 12), INF);
	vector <pair<int, vector<int>>> keys;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		vector <int> q(b);
		for (int j = 0; j < b; j++) {
			cin >> q[j];
			q[j]--;
		}
		keys.eb(a, q);
	}
	dp[0] = 0;
	for (int i = 0; i < (1 << n); i++) {
		for (auto &key : keys) {
			int ncost = dp[i] + key.f;
			int nmask = i;
			for (auto &x : key.s) {
				nmask |= 1 << x;
			}
			dp[nmask] = min(dp[nmask], ncost);
		}
	}
	if (dp[(1 << n) - 1] == INF) {
		cout << -1;
	} else {
		cout << dp[(1 << n) - 1];
	}
	return 0;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
N, M = map(int, input().split())
#L = [int(input()) for i in range(N)]
H = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]
l=[1]*N
for i in range(M):
    a,b=map(int, input().split())
    a-=1
    b-=1
    ha, hb=H[a],H[b]
    if ha==hb:
        l[a]=l[b]=0
    elif ha>hb:
        l[b]=0
    else:
        l[a]=0
print(sum(l))
    



Measured memory_bytes: 82188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc145/abc145_c.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<P> c(N);
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    c[i] = make_pair(a, b);
  }

  long np = 1;
  vector<int> v(N);
  rep(i, N) {
    np *= i + 1;
    v[i] = i;
  }

  long double sum = 0;
  do {
    rep(i, N - 1) {
      int x = c[v[i]].first;
      int y = c[v[i]].second;
      int xi = c[v[i + 1]].first;
      int yi = c[v[i + 1]].second;
      sum += sqrt(pow(x - xi, 2) + pow(y - yi, 2));
    }
  } while (next_permutation(v.begin(), v.end()));

  printf("%6Lf", sum / np);
}

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

bool fin;

bool check(string& line,int pos,int len)
{
  len++;
  string pre = name.substr(0,2); 
  //cout << "line[" << pos<< "] = " << line[pos] << ", len = " << len  << endl; 
  for(int i=3;i<=name.size();i++)
    {
      if(pos+len > line.size())
	return false;
      pre += line[pos+len];
      //cout << "line[" << pos+len << "] = " << line[pos+len] << endl;
      pos += len;
    }
  //cout << "pre == " << pre << endl;
  return pre == name;
}

void rec(string& line,int pos,int index,int len)
{
  if(fin)
    return;

  if(len == -1)
    {
      for(int i=pos;i<line.size();i++)
	{
	  if(line[i] == name[index])
	    {
	      rec(line,i+1,index+1,i-pos);
	    }
	}
      return;
    }

  if(check(line,pos-1,len))
    {
      fin = true;
      return;
    }

}

int main()
{
  int N;
  cin >> N;
  cin >> name;
  int cnt =0 ;
  for(int i=0;i<N;i++)
    {
      string s;
      cin >> s;
      if(s == name)
	{
	  cnt++;
	  continue;
	}

      if(s.length() == 1)
	{
	  if(s.find(name) != string::npos)
	    {
	      cnt++;
	    }
	}
      else if(s.length() == 2)
	{
	  map<char,int> dex;
	  for(int i=0;i<s.length();i++)
	    {
	      dex[s[i]]++;
	    }
	  if(dex[name[0]] > 0 && dex[name[1]] > 0)
	    cnt++;
	}
      else 
	{
	 
	  fin = false;
	  for(int i=0;i<s.length();i++)
	    {
	      if(s[i] == name[0])
		{
		  rec(s,i+1,1,-1);
		}
	    }
	  if(fin)
	    {
	      //cout << "FOUND!" << endl;
	      cnt++;
	    }

	}
    }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#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 rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cerr<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
int getInt(){int x;scanf("%d",&x);return x;}
template<typename T>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>ostream& operator<<(ostream&o,const v(T)&v){if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v){return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v){return o<<v.fi<<","<<v.se;}
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
template<typename T>ll suma(const v(T)&a){ll res(0);for(auto&&x:a)res+=x;return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;



int main() {
  string s, t;
  cin>>s>>t;
  int ans = INF;
  rep(i,sz(s)-sz(t)+1) {
    int now = 0;
    rep(j,sz(t)) if (s[i+j] != t[j]) ++now;
    mins(ans,now);
  }
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 3600
import std.stdio;
import std.algorithm;
import std.math;
import std.conv;
import std.string;

int readInt(){
  return readln.chomp.to!int;
}

int[] readInts(){
  return readln.chomp.split.to!(int[]);
}

void main(){
  int[] nk = readInts();
  string s = readln.chomp;
  writeln(s[0 .. nk[1]-1], s[nk[1]-1].toLower, s[nk[1] .. $]);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using  namespace std;
typedef long long ll;
#define RAP(i, n) for(ll i=0;i<(n);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
int main(){
    string s, t, u;
    ll a, b;
    cin >> s >> t >> a >> b >> u;
    if(s == u){
        a--;
    }else{
        b--;
    }
    
    cout << a << " " << b << endl;
    return 0;
 
}


Measured memory_bytes: 256
import math

def is_prime(x):
    if x == 2:
        return True
    
    if x%2 == 0:
        return False

    for i in range(3, int(math.sqrt(x))+1, 2):
        if x%i == 0:
            return False

    return True


if __name__ == "__main__":
    input_count = int(input())

    prime_count = 0
    for i in range(input_count):
        num = int(input())
        if is_prime(num) == True:
            prime_count += 1
            
    print(prime_count)


Measured memory_bytes: 5676
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    String s1 = sc.next();
    String s2 = sc.next();
    String s3 = sc.next();
    
    String s1first = s1.substring(0, 1);
    String s2first = s2.substring(0, 1);
    String s3first = s3.substring(0, 1);
    
    String s1firstUpper = s1first.toUpperCase();
    String s2firstUpper = s2first.toUpperCase();
    String s3firstUpper = s3first.toUpperCase();
    
    System.out.println(s1firstUpper + s2firstUpper + s3firstUpper);
  }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int v[30], c[30];
int main(){
	int n, ans = 0;
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> v[i];
	for(int i = 0; i < n; i++){
		cin >> c[i];
		if(v[i] > c[i])
			ans += v[i] - c[i];
	}
	cout << ans;
}

Measured memory_bytes: 256
//Love and Freedom.
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define ll long long
#define inf 20021225
#define N 110
using namespace std;
int read()
{
	int s=0,t=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')	t=-1; ch=getchar();}
	while(ch>='0' && ch<='9')	s=s*10+ch-'0',ch=getchar();
	return s*t;
}
struct edge{int to,lt;}e[N<<1]; int in[N],cnt;
void add(int x,int y)
{
	e[++cnt].to=y; e[cnt].lt=in[x]; in[x]=cnt;
	e[++cnt].to=x; e[cnt].lt=in[y]; in[y]=cnt;
}
int a[N],b[N],n;
int dep[N],dd[N],wei[N];
int calc(int x,int fr)
{
	int tmp=dep[x]; dd[x]=0;
	for(int i=in[x];i;i=e[i].lt)
	{
		int y=e[i].to; if(y==fr)	continue;
		dep[y]=dep[x]+1; tmp=max(tmp,calc(y,x)); dd[x]++;
	}
	return tmp;
}
void solve()
{
	int len=0;
	for(int i=1;i<n;i++)	dep[a[i]]=dep[b[i]]=0,len=max(len,calc(a[i],b[i])+calc(b[i],a[i])+1);
	printf("%d ",len/2+1);
	if(len&1)
	{
		ll ans=9e18;
		for(int i=1;i<n;i++)
		{
			dep[a[i]]=dep[b[i]]=0; ll tmp=2;
			if(calc(a[i],b[i])==(len>>1)&&calc(b[i],a[i])==(len>>1))
			{
				memset(wei,0,sizeof(wei));
				for(int i=1;i<=n;i++) wei[dep[i]]=max(wei[dep[i]],dd[i]);
				for(int i=0;i<len/2;i++)	tmp=tmp*wei[i];
				ans=min(ans,tmp);
			}
		}
		printf("%lld\n",ans); return;
	}
	ll ans=9e18;
	for(int i=1;i<n;i++)
	{
		dep[a[i]]=dep[b[i]]=0; ll tmp=1;
		int v1=calc(a[i],b[i]),v2=calc(b[i],a[i]);
		if(v1>v2)	swap(v1,v2),swap(b[i],a[i]);
		if(v1==(len/2-1)&&v2==(len/2))
		{
			dep[b[i]]=0; calc(b[i],0);
			memset(wei,0,sizeof(wei));
			for(int i=1;i<=n;i++) wei[dep[i]]=max(wei[dep[i]],dd[i]);
			for(int i=0;i<len/2;i++)	tmp=tmp*wei[i];
			ans=min(ans,tmp);
		}
	}
	for(int i=1;i<n;i++)
	{
		dep[a[i]]=dep[b[i]]=0; int v1=calc(a[i],b[i]),v2=calc(b[i],a[i]);
		if(max(v1,v2)<=len/2)
		{
			memset(wei,0,sizeof(wei)); ll tmp=2;
			for(int j=1;j<=n;j++)	wei[dep[j]]=max(wei[dep[j]],dd[j]);
			for(int j=0;j<=len;j++)	if(wei[j])	tmp=tmp*wei[j];
			ans=min(ans,tmp);
		}
	}
	printf("%lld\n",ans);
}
int main()
{
	n=read();
	for(int i=1;i<n;i++)	a[i]=read(),b[i]=read(),add(a[i],b[i]);
	solve();
	return 0;
}

Measured memory_bytes: 128
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define REP(i,k,n) for (int i = k; i <= n; ++i) 
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    rep(i,0,s.size()){
        s[i]=(s[i]+n-65)%26+65;
    }
    cout<<s;
}
    
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    // fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

const i64 MAXN = 100006;

i64 n, k;
i64 a[MAXN];
string s;

i64 q[256];

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> k;

    cin >> q['s'];
    cin >> q['p'];
    cin >> q['r'];

    cin >> s;

    i64 R = 0;
    for (i64 i = 0; i < n; i++) {
        if (i >= k && s[i - k] == s[i]) {
            s[i] = 't';
        }
    }

    for (i64 i = 0; i < n; i++) {
        R += q[s[i]];
    }
    cout << R << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		System.out.println(a + (int) Math.pow(a, 2) + (int) Math.pow(a, 3));

	}

}


Measured memory_bytes: 35704
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long int ll;
template<typename T> T changeMax(T& a, T b){if(a < b)a = b;return 0;}

int main()
{
    int a, b;
    cin >> a >> b;
    cout << (a*b)-a-b+1 << endl;
    system("pause");
}

Measured memory_bytes: 504
H, W = map(int, input().split())

Map = [list(str(input())) for _ in range(H)]
dirc = ((0, 1), (1, 0), (-1, 0), (0, -1))
ans = 'Yes'
for h in range(H):
    for w in range(W):
        if Map[h][w]=='#':
            for y, x in dirc:
                if h+y<0 or h+y>=H or w+x<0 or w+x>=W:
                    continue
                if Map[h+y][w+x]=='#':
                    break
            else:
                ans='No'

print(ans)

Measured memory_bytes: 39152
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[200005],b[200005],ans[200005];
signed main(void){
	int n,s=0;
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		++b[a[i]];
	}
	for(int i=1;i<=200000;i++) s+=(b[i]*b[i]-b[i])/2;
	for(int i=1;i<=200000;i++) ans[i]=s-(b[i]-1);
	for(int i=1;i<=n;i++) cout<<ans[a[i]]<<endl;
	return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int gcd( int x, int y ){ return y ? gcd(y, x%y) : x; }
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
int a=0,b=-1,c=0,d=0;
string f="";
std::cin >> f;
rep(i,3){
  if(f[i]=='1')f[i]='9';
  else f[i]='1';
}
std::cout << f << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << endl;}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
int main() {
	var(int, n, a);
	print(n * n - a);
	return 0;
}


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

using namespace std;

int main(){
    int a, b;
    cin>>a>>b;
    bool flag[3]={true, true, true};
    flag[a-1]=false;flag[b-1]=false;
    for(int i=0;i<3;i++){
        if(flag[i]){
            cout<<i+1<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>N>>K;
    vec a(N);
    rep(i,N){
        cin>>a[i];
        --a[i];
    }
    vec sum(N+1,0);
    rep(i,N){
        (sum[i+1] = sum[i] + a[i])%=K;
    }
    map<ll,ll> mods;
    mods[0] = 1;
    ll ans = 0;
    reps(i,1,N+1){
        if(i >= K) --mods[sum[i - K]];
        ans += mods[sum[i]];
        ++mods[sum[i]];
        //cout<<i<<' '<<ans<<endl;
    }
    cout<<ans<<endl;
}

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

using namespace std;

#define ll long long

void solve() {
	int a, b, c, n;
	int cnt = 0;
	cin >> a >> b >> c >> n;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (i*500 + j*100 + k*50 == n) {
					cnt++;
				}
			}
		}
	}
	cout << cnt << "\n";
}

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

	int t = 1, i = 1;
	//cin >> t;
	while(t--) {
		//cout << "Case #" << i << ": ";
		solve();
		//i++;
	}
	return 0;
}



Measured memory_bytes: 3616
s = input()
t = input()
n = len(s)
m = len(t)
cand = []
for i in range(n-m+1):
    flag = True
    for j in range(m):
        if s[i+j] != t[j] and s[i+j] != "?":
            flag = False
            break
    if flag:
        tmp = (s[:i] + t + s[i+m:]).replace("?", "a")
        cand.append(tmp)
cand = sorted(cand)
if cand:
    print(cand[0])
else:
    print("UNRESTORABLE")


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
#include <climits>
#include <cstring>

typedef long long ll;

using namespace std;

void solve(){
    int n, m;
    cin >> n >> m;
    int x[n][m], y[m];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> x[i][j];
        }
    }
    for(int i = 0; i < m; i++){
        cin >> y[i];
    }
    int res = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            res += x[i][j] * y[j];
        }
        cout << res << endl;
        res = 0;
    }
}

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

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

int dg(long long n){
  int count=0;
  while(n>0){
    n/=10;
    count++;
  }
  return count;
}

int main(){
  long n;
  cin>>n;
  int f=dg(n);
  for(long a=1;a<=long(sqrt(n)+1);a++){
     if(n%a==0){
       long b=n/a;
       int m = max(dg(a),dg(b));
       f=min(f,m);
     }else{
       ;
     }
  }
  cout<<f<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<b){
    printf("a < b\n");
      }
 else if(a>b){
    printf("a > b\n");
  }
 else{
    printf("a == b\n");
  }
  return 0;
}

Measured memory_bytes: 580
#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>;
using vi = vector<int>;
using vv = vector<vi>;
//const int MOD = 1000000007;
//const int MOD = 998244353;
const ll INF = 1001001001001;

int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0; i<(int)s.size(); i++)
        ans += s[i]-'0';
    if(ans%9==0)
    cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3752
import kotlin.system.exitProcess

fun main(args: Array<String>){
  val n = readLine()!!.toInt()

  val array = IntArray(81)
  for( i in 0..8 ) for( j in 0..8 )
    array[i*9+j] = (i+1)*(j+1)

  for( i in 0..80 )
    if( array[i] == n ){
      println("Yes")
      exitProcess(0)
    }

  println("No")
}


Measured memory_bytes: 31772
#include<iostream>
#include<string>
using namespace std;
int main(){
int N;
string S;
cin>>N;
cin>>S;
int count=0;
for(int p=0;p<N-2;p++){
if(S[p]=='A'&&S[p+1]=='B'&&S[p+2]=='C'){
  count++;
}
}
cout<<count<<endl;
}
 

Measured memory_bytes: 384
import math

def run():
    a,b,C=tuple(map(float,input().split()))
    
    radian=2.0*math.pi*float(C)/float(360.0)
    
    c=math.sqrt(a*a+b*b-2.0*a*b*math.cos(radian))
    
    L=a+b+c
    
    
    #Heron's formula
    s=(a+b+c)/2.0
    S=math.sqrt(s*(s-a)*(s-b)*(s-c))
    
    h=2.0*S/a
    
    print(f"{S:.30f}")
    print(f"{L:.30f}")
    print(f"{h:.30f}")


run()



Measured memory_bytes: 5704
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int n;
    int YES;
    int YES2;
    scanf("%d",&n);
    for(int count=1;count<=n;count=count+2){
        YES=0;
        for(int count2=1;count2<=count;count2++){
            if(count%count2==0){YES++;}
        }
        if(YES==8){YES2++;}
    }
    printf("%d",YES2);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    string s;
    cin >> s;
    int q, t, f;
    char new_one;
    int state = 0;
    deque<char> dq;
    for(char c: s)
        dq.push_back(c);
    cin >> q;
    while(q--) {
        cin >> t;
        if (t == 1) {
            state = 1 - state;
        } else { // t == 2
            cin >> f >> new_one;
            if (state == 1) {
                f = 3 - f;
            }
            if (f == 1) {
                dq.push_front(new_one);
            } else {
                dq.push_back(new_one);
            }
        }
    }
    if (state == 0) {
        for(char c: dq)
            cout << c;
        cout << endl;
    } else {
        for(int i = dq.size()-1; i >= 0; i--)
            cout << dq[i];
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 976
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

string s;
vector<char> vec;
int cnt;
int ans;
int j;
vector<int> ta;

signed main() {
	cin >> s;
	for (int i = 0; i < (int)s.size(); i++) {
		if (s[i] != 'x')vec.push_back(s[i]);
	}
	for (int i = 0; i < (int)vec.size() / 2; i++) {
		if (vec[i] != vec[(int)vec.size() - 1 - i]) {
			cout << -1 << endl;
			return 0;
		}
	}
	int x = (int)vec.size();
	for (int i = 0; i < (int)s.size(); i++) {
		if (s[i] != 'x') {
			if ((int)vec.size() - cnt <= ((int)vec.size()-1) / 2) {
				ans += max(i - j, ta[x - cnt]) - min(i - j, ta[x - cnt]);
			}
			else {
				ta.push_back(i - j);
			}
			cnt++;
			j = i + 1;
		}
	}
	if(j)ans += abs(((int)s.size() - j) - ta[0]);
	cout << ans << endl;
}

Measured memory_bytes: 1148
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int findSumOfDigits(int n)
{
    int sum = 0;
    while (n > 0) { // n が 0 になるまで
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
int n;
cin>>n;
int a = findSumOfDigits(n);
if(n%a==0) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define FAST ios::sync_with_stdio(false);
#define pb push_back
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 5;
const int maxn = (int)1e6 + 5;
using namespace std;

ll a[3005];

int main()
{
	int n; scanf("%d", &n);
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		scanf("%lld", a + i);
		ans += --a[i];
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  string na,nb;
  for (int i = 0; i < b; i++){
    na += to_string(a);
  }
  for (int i = 0; i < a; i++){
    nb += to_string(b);
  }
  cout << min(na,nb) << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    ll a, b, k;
    cin >> a >> b >> k;
    for (int i = 0; i < k; i++)
    {
        if(i%2==0){
            if (a % 2)
            {
                a--;
            }
            b += a / 2;
            a /= 2;
        }
        else{
            if (b % 2)
            {
                b--;
            }
            a += b / 2;
            b /= 2;
        }
    }
    cout<<a<<" "<<b<<endl;
}


Measured memory_bytes: 764
#include<stdio.h>
int main(void)
{
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
  if(a == b + c || b == c + a || c == a + b){
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#define ALL(a) (a).begin(),(a).end()

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};




long long fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
  // 前処理
  //COMinit();

  ll A,B,T;
  cin>>A>>B>>T;
  ll ans=0;
  ll tmp=T/A;
  cout<<tmp*B<<endl;


  return 0;
 
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

res = 0
cur = A[0]
for a in range(N-1):
    if A[a+1] == cur + 1:
        res += C[A[a+1]-2]
    cur = A[a+1]
res += sum(B)
print(res)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    ll a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;
    ll d = abs(b - a);
    ll sp = v - w;
    if (sp * t - d >= 0)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
import math
def judge(n):
    
    num=int(math.sqrt(n)//1)
    for i in range(2,num+1):
        if n%i==0:
            return False
    return True
x=int(input())
for i in range(x,10**5+4):
    if judge(i):
        print(i)
        break

Measured memory_bytes: 9136
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
#define ar array 
#define int long long
const int mod = 1e9+7;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}




void test_case() {
	int n; cin >> n;
	vector<int> a(n);
	mint sum = 0;
	for(int i = 0  ; i < n ; i++){
		cin >> a[i];
		sum = sum+a[i];
	}
	mint sum2 = sum*sum;
	mint sum3 = 0;
	for(int i = 0 ; i < n ; i++)
		sum3 += a[i]*a[i];
	mint k = (sum2-sum3)/2;
	cout<<k;
}
 
int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T = 1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
}


Measured memory_bytes: 4776
import copy
H, W, K = map(int, input().split())
C = [list(input()) for _ in range(H)]
ans = 0
for i in range(1<<H):
  D = copy.deepcopy(C)
  for h in range(H):
    if (i>>h & 1):
      for l in range(W):
        D[h][l] = '.'
  for j in range(1<<W):
    k = 0
    for w in range(W):
      if not (j>>w & 1):
        for m in range(H):
          if D[m][w] == '#':
            k += 1
    if k == K:
      ans += 1
print(ans)

Measured memory_bytes: 9356
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj),rend(obj)
typedef long long int ll;
typedef long double ld;
const ll INF = (1LL << 60);
const int INf = 1e9;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    fill((T*)array, (T*)(array + N), val);
}
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main() {   
    int n, m; cin >> n >> m;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    UnionFind tree(n);
    rep(i, m) {
        int x, y; cin >> x >> y;
        tree.unite(x - 1, y - 1);
    }int cnt = 0;
    rep(i, n) {
        if (tree.same(i, p[i] - 1)) cnt++;
    }cout << cnt << endl;
}

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

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


    for(int i=0; i<3; i++){
      if(s[i]=='7'){
        cout<< "Yes" <<endl;
        return 0;
      }
    }
    cout<< "No" <<endl;

    return 0;
}


Measured memory_bytes: 3604