akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	K, S := ReadInt(), ReadString()
	if len(S) <= K {
		fmt.Println(S)
		return
	}
	fmt.Println(S[:K] + "...")
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int n, m;
vec g[10];

void dfs(int& cnt, vector<bool> v, int par) {
    bool check = true;
    rep(i, n) if (!v[i]) check = false;
    if (check) {
        cnt++;
        return;
    }

    for (auto&& c : g[par]) {
        if (!v[c]) {
            v[c] = true;
            dfs(cnt, v, c);
            v[c] = false;
        }
    }
}

int main() {
    cin >> n >> m;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    int cnt = 0;
    vector<bool> v(n, false);
    v[0] = true;
    dfs(cnt, v, 0);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>

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

using namespace std;

const int INF = 10000;

int main()
{
	
	int a, b;

	cin >> a >> b;

	cout << a / b << " ";
	cout << a % b << " ";
	cout << fixed << setprecision(6) << (double)a / b << endl;

	return 0;
}



Measured memory_bytes: 3288
#include <iostream>
using namespace std;
const int N = 100000;
int a[N];
bool check(int i){
	return a[a[i]] == i;
}

int 
main(){
	int n;
	cin >> n;
	for(int i = 0; i < n;i++){
		int tmp;
		cin >> tmp;
		a[i] = tmp-1;
	}
	int sum = 0;
	for(int i = 0; i < n;i++){
		if(check(i))
			sum++;
	}
	cout << sum/2 << endl;
}



Measured memory_bytes: 640
/*..........AAKASH GOYAL............*/
/*............DAIICT................*/

#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2")

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

#define    int                      long long int

#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int tt; cin >> tt; while(tt--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    ppl                      pair <int , pii>               
#define    sp(x)                    setprecision(x)


int32_t main()
{
    speed upp
    string s1,s2,s3;
    cin>>s1;
    f(i,0,sz(s1)-1)
        cout<<"x";
        
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		PriorityQueue<Pair> q = new PriorityQueue<Pair>();
		Pair[] a = new Pair[n];
		
		for( int i=0 ; i<n ; i++ ) {
			a[i] = new Pair(sc.nextInt(), sc.nextInt() );
			q.add(a[i]);
		}
		
		Arrays.sort(a);
		
		boolean canFinish = true;
		int time =0;
		for( int i = 0 ; i< n ; i++ ) {
			time+= a[i].weight;
			if( a[i].limit < time ) {
				canFinish = false;
				break;
			}
		}
		
		if( canFinish ) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		

	}

	public static class Pair implements Comparable<Pair>{
		int weight = 0;
		int limit = 0;
		
		public Pair(int weight, int limit) {
			super();
			this.weight = weight;
			this.limit = limit;
		}

		@Override
		public int compareTo(Pair o) {
			return limit - o.limit;
		}
	
	}
}


Measured memory_bytes: 66528
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <stdio.h>

using namespace std;

//typedefリスト
typedef vector<long long int> vint;
typedef vector<string> vstr;
typedef long long int llint;



int main(void) {
	int n, m;
	cin >> n >> m;
	cout << (n - 1)*(m - 1) << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int A, B, C, D, L, R;

  std::cin >> A >> B >> C >> D;

  L = A + B;
  R = C + D;

  std::cout << (L == R ? "Balanced" : L > R ? "Left" : "Right") << std::endl;

  return 0;
}


Measured memory_bytes: 888
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>



const int mod = 1000000007;

struct s {
	int a, n;
};

int search(s* S, int p, int n) {
	if (S[0].a == p)return 0;
	int r = 0;
	for (int j = 30; j >= 0; j--) {
		if ((1 << j) >= n)continue;
		int c = r + (1 << j);
		if (S[c].a == p) {
			return c;
		}
		else if (S[c].a > p) {
			r = c;
		}
	}
	return -1;
}

int main() {
	int N;
	scanf("%d", &N);
	int *A = new int[N];
	for (int i = 0; i < N; i++) {
		scanf("%d", A + i);
	}
	std::vector
 S;
	std::sort(A, A + N);
	int l = 0, c = -1;
	for (int i = N - 1; i >= 0; i--) {
		if (A[i] == l) {
			S[c].n++;
		}
		else {
			s b = { A[i],1 };
			l = A[i];
			c++;
			S.push_back(b);
		}
	}
	int res = 0;
	for (int i = 0; i < S.size();) {
		if (S[i].n == 0) {
			i++;
		}
		else {
			int p;
			for (int j = 0;; j++) {
				if ((1 << j) > S[i].a) {
					p = (1 << j) - S[i].a;
					break;
				}
			}
			int c = search(S.data(), p, S.size());
			if (c != -1) {
				if (c == i){
					if (S[c].n >= 2) {
						S[c].n -= 2;
						res++;
					}
					else {
						i++;
					}
				}
				else if (c != i) {
					if (S[c].n >= 1) {
						S[c].n--;
						S[i].n--;
						res++;
					}
					else {
						i++;
					}
				}
			}
			else {
				i++;
			}
		}
	}
	printf("%d", res);
}





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

int N,arr[200200],mod = 1e9 + 7;
long long prefix[200200],sum;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>N;
	for(int i = 1;i <= N;i++){
		cin>>arr[i];
		prefix[i] = prefix[i - 1] + arr[i];
	}
	for(int i = 2;i <= N;i++){
		sum += (prefix[i - 1] % mod) * (arr[i] % mod);
		sum %= mod;
	}
	cout<<sum<<endl;
}


Measured memory_bytes: 5928
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}



int main(){
fastio();
   ll a,b,d;
  cin>>a>>b>>d;
  
  ll temp=b/d-(a-1)/d;
  cout<<temp<<endl;





return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long
const int N = 105;
using namespace std;
int gi(){
  char ch=getchar(); int x=0,q=0;
  while(ch<'0' || ch>'9') (ch=='-'?q=1:0),ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
int w[N],v[N],s;
ll f[N][N*4],ans;
inline void dp(ll &x,ll y){
  x=x>y?x:y; return;
}
int main(){
  int n=gi(),W=gi(),m=3*n;
  memset(f,-60,sizeof(f));
  for (int i=1; i<=n; ++i)
    w[i]=gi(),v[i]=gi();
  s=w[1];
  for (int i=1; i<=n; ++i)
    w[i]-=s;
  f[0][0]=0;
  for (int k=1; k<=n; ++k)
    for (int i=n-1; i>=0; --i)
      for (int j=0; j<=m; ++j)
	dp(f[i+1][j+w[k]],f[i][j]+v[k]);
  for (int i=1; i<=n; ++i)
    for (int j=0; j<=m; ++j)
      if (1ll*s*i+j<=W)
	dp(ans,f[i][j]);
  cout<<ans;
  return 0;
}


Measured memory_bytes: 640
n,m=map(int,input().split())
switch=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    cnt=[0]*m
    for j in range(n):
        if (i>>j)&1==1:
            for k in range(m):
                if j+1 in switch[k][1:]:
                    cnt[k]+=1
    l=[i%2 for i in cnt]
    if l==p:
        ans+=1
print(ans)

Measured memory_bytes: 3064
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"3"# => "2",
r#"6"# => "9",
 // r#"11"# => "30",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: usize,
        b: usize,
    }
    let ab = a * b;
    if ab * 1 % 2 != 0 || ab * 2 % 2 != 0 || ab * 3 % 2 != 0 {
        "Yes"
    } else {
        "No"
    }.to_string()
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n,w;
   cin>>n>>w;

   int a[n][2];
   long long int wt[n],val[n];
   int sum=0;
   for(int i=0;i<n;i++)
   {
     cin>>wt[i]>>val[i];
     sum=sum+val[i];
   }
   
   long long int dp[n+1][sum+1];   

   memset(dp,0,sizeof(dp));

   for(int i=0;i<=n;i++)
   {
      for(int j=0;j<sum+1;j++)
      {
         dp[i][j]=INT_MAX;
      }
   }

   int max1=1;
   

   for(int i=0;i<=n;i++)
      dp[i][0]=0;

    // dp[0][0]=0;

   for(int i=1;i<=n;i++)
   {
      for(int j=1;j<sum+1;j++)
      {
         if(val[i-1]>j)
         {
            dp[i][j]=dp[i-1][j];
         }
         else
         {
            dp[i][j]=min(dp[i-1][j],dp[i-1][j-val[i-1]]+wt[i-1]);
            //dp[i][j]=dp[i-1][j-val[i-1]]+wt[i-1];
         }
         if(dp[i][j]<=w)
           max1= max (max1 ,j);
      }
   }
   // for(int i=0;i<n;i++)
   // {
   //    for(int j=0;j<=sum+1;j++)
   //    cout<<dp[i][j]<<" ";

   //    cout<<"\n";
   // }


   cout<<max1;


}


Measured memory_bytes: 79104
#include <stdio.h>

int main(void){
  int H,W;
  char C[100][100];
  char C2[200][100];
  int i,j,k;

  scanf("%d%d",&H,&W);
  for(i=0;i<=H-1;i++){
    for(j=0;j<=W-1;j++){
    scanf(" %c",&C[i][j]);
    }
  }

   for(i=0;i<=2*H-1;i++){
     for(j=0;j<=W-1;j++){
       k = i/2;
       C2[i][j] = C[k][j];
       printf("%c",C2[i][j]);
     }
     printf("\n");
   }

  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
const unsigned char TRUE = 1;
const unsigned char FALSE = 0;

void insert();
void print();
void saiki(int);

int aaa[8],bbb[8],ccc[2*8-1],ddd[2*8-1];

char R[8][8];
void insert(){
  int i,j;
  for(i=0;i<8;i++){
    aaa[i]=-1;
    bbb[i]=-1;
    
  }
  for(i=0;i<2*8-1;i++){
    ccc[i]=-1;
    ddd[i]=-1;
  }
}
void print(){
  int i,j;
  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      if(R[i][j]){
	if(aaa[i]!=j)
	  return;
      }
    }
  }
  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      if(aaa[i]==j)
	printf("Q");
      else printf(".");
    }
    printf("\n");
  }
  //printf("a");
}
void saiki(int s){
  int j;
  if(s==8){
    print();
    return;
  }
  for(j=0;j<8;j++){
    if(1==bbb[j] || 1==ccc[s+j] || 1==ddd[s-j+8-1])
     continue;
    aaa[s]=j;
    bbb[j]=ccc[s+j]=ddd[s-j+8-1]=1;
    //次の行を試す
    saiki(s+1);
    //(i,j)に配置されているクイーンを取り除く
    aaa[s]=bbb[j]=ccc[s+j]=ddd[s-j+8-1]=-1;
  }
}
int main(){
  int i,k,m,j,n;
  insert();//初期か
  for(i=0;i<8;i++)
    for(j=0;j<8;j++)
      R[i][j]=FALSE;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&k);
    scanf("%d",&m);
    R[k][m]=TRUE;
  }
  saiki(0);
  return 0;
}
  



Measured memory_bytes: 2112
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,m=map(int,input().split())
    s=[]
    for i in range(m):
        ss=[int(_) for _ in input().split()]
        s.append(ss[1:])
    P=[int(_) for _ in input().split()]
    ans=0
    for j in range(2**n):
        i=0#i桁目が1ならi番目を使う
        nn=j#nn=1010110
        Q=[0]*m #onになってる数
        while nn>0:
            if ((nn&1)==1):
                for x,ss in enumerate(s):
                    if i+1 in ss:
                        Q[x]+=1
            nn>>=1
            i+=1
        for x,q in enumerate(Q):
            if q%2!=P[x]:
                break
        else:
            ans+=1
    print(ans)


if __name__=='__main__':
    main()

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

int main(int argc, char const *argv[])
{
	string s,t,u;
	int a,b;
	cin>>s>>t>>a>>b>>u;
	if (s==u)
	{
		cout<<a-1<<" "<<b<<endl;
	}
	else
	{
		cout<<a<<" "<<b-1<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
def main():
    import bisect
    import math
    import sys
    import heapq
    def f(s):
        return -int(s)

    n,m=map(int,input().split())
    a=list(map(f,input().split()))
    heapq.heapify(a)

    for i in range(m):
        tmp=heapq.heappop(a)
        tmp=math.ceil(tmp/2)
        heapq.heappush(a,tmp)

    print(-sum(a))
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 14380
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;

int main(){
  Int T;int N;cin >> N >> T;
  Int ans = INF;
  rep(i,N){
    Int c,t;cin >> c >> t;
    if(t<=T){
      ans = min(ans,c);
    }
  }
  if(ans==INF) cout << "TLE" << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	_ = getNextInt(scanner)
	a := getNextInt(scanner) - 1
	b := getNextInt(scanner) - 1
	c := getNextInt(scanner) - 1
	d := getNextInt(scanner) - 1
	s := getNextString(scanner)

	for i := a; i < c; i++ {
		if i+2 < c && s[i+1] == '#' && s[i+2] == '#' {
			fmt.Println("No")
			return
		}
	}
	for i := b; i < d; i++ {
		if i+2 < d && s[i+1] == '#' && s[i+2] == '#' {
			fmt.Println("No")
			return
		}
	}
	if c < d {
		fmt.Println("Yes")
		return
	}

	for i := b; i < d+1; i++ {
		if s[i-1] == '.' && s[i] == '.' && s[i+1] == '.' {
			fmt.Println("Yes")
			return
		}
	}

	fmt.Println("No")
	writer.Flush()
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;
double a, b, c, d;
vector<double> vec,vec2;

int main() {
	cin >> a >> b >> c;
	for (int i = 0; i < a; i++) {
		cin >> d;
      	d=b - 0.006*d - c;
      	if(d<0)d=-d;
		vec.push_back(d);
		vec2.push_back(d);
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < a; i++) {
		if (vec2[i] == vec[0]) {
			cout << i+1;
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

bool isPrime(ll n){
	if(n==1)return false;
	for(ll i=2;i*i<=n;i++)if(n%i==0)return false;
	return true;
}

void solve(ll n,ll p){
	int cnt=0;
	vl ls,sum;
	for(ll i=n+1;cnt<100;i++){
		if(isPrime(i)){
			cnt++;
			ls.push_back(i);
		}
	}
	rep(i,ls.size())range(j,i,ls.size())sum.push_back(ls[i]+ls[j]);
	sort(all(sum));
	cout<<sum[p-1]<<"\n";
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,p;
	while(cin>>n>>p,n!=-1){
		solve(n,p);
	}
}


Measured memory_bytes: 3256
#include <iostream> 
#include <bits/stdc++.h>
#include <vector> 
#include <algorithm> 
#include <string>
#include <cmath>
#include <iomanip> 
#include<climits> 
#include <utility>      
#include <numeric> 
#include <iterator>
#include <map> 
using namespace std; 
#define ll long long int
int main()
{
  int n;
  string s,t;
  cin>>n;
  cin>>s>>t;
  string p="";
  for(auto i=0;i<n;i++)
  {
    p+=s[i];
    p+=t[i];
  }
  cout<<p<<endl;
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,m;
    cin>>n>>m;
    vvi vec(n,vi(m));
    int sum=0;
    REP(i,n){
        REP(j,m){
            cin>>vec[i][j];
        }
    }
    
    vector<pair<P,P>> ans;
    REP(i,n){
        REP(j,m){
            if(vec[i][j]%2){
                if(i+1<n){
                    ans.pb({{i+1,j+1},{i+2,j+1}});
                    vec[i][j]--;
                    vec[i+1][j]++;
                }else if(j+1<m){
                    ans.pb({{i+1,j+1},{i+1,j+2}});
                    vec[i][j]--;
                    vec[i][j+1]++;
                }
            }
        }
    }
    cout<<ans.size()<<endl;
    REP(i,ans.size()){
        auto t=ans[i];
        cout<<t.fi.fi<<" "<<t.fi.se<<" "<<t.se.fi<<" "<<t.se.se<<endl;
    }

    return 0;
}

Measured memory_bytes: 5232
#include<iostream>

#define B 4
#define F 3
#define R 10

int main(void){
    int info[B][F][R]={};
    int n,i,j,k;
    int b,f,r,v;
    std::cin>>n;
    for(i=0;i<n;i++){
         std::cin>>b>>f>>r>>v;
        info[b-1][f-1][r-1]+=v;
    }
    for(i=0;i<B;i++){
        for(j=0;j<F;j++){
            for(k=0;k<R;k++) std::cout<<" "<<info[i][j][k];
            std::cout<<std::endl;
        }
        if(i!=B-1)std::cout<<"####################"<<std::endl;
    }
    return 0;
}

Measured memory_bytes: 3072
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll a,b;
cin >> a >> b;
cout << a * b << endl;
}

Measured memory_bytes: 3640
#include <math.h>
#include <ctype.h>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

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

    unordered_map<char, int> mp;
    REP(i, w.size()) mp[w[i]]++; 
    int f = 1;
    for(auto &x : mp){
        if(x.second % 2 != 0){
            f = 0;
            break;
        }
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

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

    if(s == "AAA" || s == "BBB"){
        cout << "No";
    }
    else{
        cout << "Yes";
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
    int M = 13;
    bool S[M], H[M], C[M], D[M];
    for (int i=0;i<M;i++) {
        S[i] = false;
        H[i] = false;
        C[i] = false;
        D[i] = false;
    }
    int n;
    cin >> n;
    char c;
    int k, l;
    for (int i=0;i<n;i++) {
        cin >> c;
        cin >> l;
        k = l-1;
        switch (c) {
            case 'S':
                S[k] = true;
                break;
            case 'H':
                H[k] = true;
                break;
            case 'C':
                C[k] = true;
                break;
            case 'D':
                D[k] = true;
                break;
        }
    }
    for (int i=0;i<M;i++) {
        k = i+1;
        if (!S[i]) {
            cout << "S " << k << endl;
        }
    }
    for (int i=0;i<M;i++) {
        k = i+1;
        if (!H[i]) {
            cout << "H " << k << endl;
        }
    }
    for (int i=0;i<M;i++) {
        k = i+1;
        if (!C[i]) {
            cout << "C " << k << endl;
        }
    }
    for (int i=0;i<M;i++) {
        k = i+1;
        if (!D[i]) {
            cout << "D " << k << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3056
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t {... : as Swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (auto &v : a)
        cin >> v;
    if (a[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    ll count = 0;
    auto fromI = 0;
    auto prev = a[0];
    for (auto i = 1; i < n; i++) {
        if (a[i] <= prev) {
            if (a[i] > i) {
                count = -1;
                break;
            }
            count += a[i];
            fromI = i;
        } else if (a[i] == prev + 1) {
            count++;
        } else if (a[i] > prev + 1) {
            count = -1;
            break;
        }
        prev = a[i];
    }
    cout << count << endl;
    
    return 0;
}



Measured memory_bytes: 1792
#include <stdio.h>

int main(int argc, const char * argv[])
{
    int mnt[10], i, j, tmp;
    
    for (i = 0; i < 10; i++) {
        scanf("%d", &mnt[i]);
        if (mnt[i] < 0 || mnt[i] > 10000)
            i -= 1;
    }
    
    for (i = 0; i < 9; i++) {
        for (j = 0; j < 9; j++) {
            if (mnt[j] < mnt[j+1]) {
                tmp = mnt [j];
                mnt[j] = mnt[j+1];
                mnt[j+1] = tmp;
            }
        }
    }
    
    for (i = 0; i < 3; i++) {
        printf("%d\n", mnt[i]);
    }
    
    
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define ll long long
#define MAX 100005
#define pb push_back
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const double PI  =3.141592653589793238463;
long long MOD = 1000000007;

int stringToInteger(string x){
    int gg=0;
    stringstream geek(x);
    geek >> gg;
    return gg;
}

ll powmod(ll a,ll b,ll m)
{
    ll ans=1;
    while(b>0){ if(b%2)
        {ans*=a; ans%=m;}
         b/=2; a=a*a; a=a%m;
        }
        return ans%m;
}
ll gcd(ll a,ll b)
{

    return __gcd(a,b);
}
ll mulmod(ll a,ll b,ll m)
{  ll ans=0;
    a %=m;
    while (b>0)
    {       if(b&1) ans = (ans + a) % m;
        a = (a * 2)%m;
        b /= 2;
    }
    return ans % m;
}

ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a;
 while(b > 0)
 	{
 		if(b%2 == 1)
 	{
 		x=(x*y);
 		if(x>MOD) x%=MOD;
 	}
 	y = (y*y);
 	if(y>MOD) y%=MOD;
 	b /= 2;
 	}
 return x;
}
int main()
{

    int a,b,c,d,e,k;
    int arr[5];
    bool f =false;
    int brr[5];
    cin>>arr[0]>>arr[1]>>arr[2]>>arr[3]>>arr[4];
    long long sum=0;
    for(int i=0;i<5;i++) { sum+=arr[i];brr[i]=(10 - arr[i]%10); if(brr[i]==10) brr[i]=0;}
    sort(brr,brr+5);
    for(int i=0;i<4;i++) { sum+=brr[i];}
    cout<<sum<<endl;

}


Measured memory_bytes: 256
n, m = map(int, input().split())
mod = 10**9+7
modp = mod
max_n = 10 ** 6 + 1               # 必要分だけ用意する
fact = [1, 1] + [0]*max_n     # fact[n] = (n! mod modp)
factinv = [1, 1] + [0]*max_n  # factinv[n] = ((n!)^(-1) mod modp)
inv = [0, 1] + [0]*max_n      # factinv 計算用

def cmb(n, r, p):
    assert n < p, 'n is less than modp'
    assert n < max_n, 'n in less than max_n'
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return (fact[n] * (factinv[r] * factinv[n-r])%p) % p

for i in range(2, max_n + 1):
    fact[i] = (fact[i-1] * i) % modp
    inv[i] = (-inv[modp % i] * (modp // i)) % modp
    factinv[i] = (factinv[i-1] * inv[i]) % modp

def factorization(m):
    arr = []
    temp = m
    # 一旦負にするとceilと同じ挙動となる。//1はfloatを返すのでintが必要
    for i in range(2, int(-(-m**0.5//1))+1):
        if temp%i==0:
            cnt = 0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    
    if temp!=1:
        arr.append([temp, 1])
    
    if arr==[]:
        arr.append([n, 1])
    return arr

arr = factorization(m)

ans = 1
for k, v in arr:
    temp = cmb(v+n-1, n-1, mod)
    ans = (ans * temp) % mod
if m == 1:
    print(1)
else:
    print(ans)



Measured memory_bytes: 135280
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl ans(n + 1, 0);
  rep2(x, 1, 101) rep2(y, 1, 101) rep2(z, 1, 101) {
    ll now = x * x + y * y + z * z + x * y + y * z + z * x;
    if(now <= n) ans[now]++;
  }
  rep2(i, 1, n + 1) cout << ans[i] << '\n';
}

Measured memory_bytes: 3548
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    m,d = LI()
    ans = 0
    for i in range(1,m+1):
        for j in range(1,d+1):
            d1 = j%10
            d2 = j//10
            if d1 >= 2 and d2 >= 2 and d1*d2 == i:
                ans += 1
    print(ans)
    return

#B
def B():
    def add(i):
        while i <= m:
            bit[i] += 1
            i += i&-i

    def sum(i):
        res = 0
        while i > 0:
            res += bit[i]
            i -= i&-i
        return res

    n,k = LI()
    m = 2000
    a = LI()
    bit = [0]*(m+1)
    ans = 0
    for i in range(n):
        ans += (i-sum(a[i]))*k
        add(a[i])
    inv = pow(2,mod-2,mod)
    for i in range(n):
        ans += sum(a[i]-1)*k*(k-1)*inv%mod
    print(ans%mod)
    return

#C
def C():
    n = I()

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 42860
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mid ((l+r)>>1)
#define SZ(x) ((x).size())
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(int (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(int (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
const int maxn=1e5+5;
int n,tot,flag,rt;
int d[maxn],a[maxn],head[maxn],des[maxn<<1],nxt[maxn<<1];
void adde(int x,int y){
	des[++tot]=y;nxt[tot]=head[x];head[x]=tot;
}
int dfs(int x,int fa){
	int tot=0,maxi=0;
	Rep(p,x)if(des[p]!=fa){
		int now=dfs(des[p],x);
		tot+=now;
		maxi=max(maxi,now);
	}
	if(d[x]==1)return a[x];
	int can=min(tot-maxi,tot/2);
	if(x!=rt){
		int need=tot-a[x];
		if(need<0||can<need)flag=1;
		return tot-2*need;
	}else{
		if(can*2!=tot||can!=a[x])flag=1;
	}
}
int main(){
	read(n);
	rep(i,1,n)read(a[i]);
	rep(i,1,n-1){
		int x,y;read(x);read(y);
		adde(x,y);adde(y,x);
		d[x]++;d[y]++;
	}
	if(n==2){
		if(a[1]==a[2])puts("YES");
		else puts("NO");
		return 0;
	}
	rep(i,1,n)if(d[i]>1)rt=i;
	dfs(rt,0);
	if(flag)puts("NO");
	else puts("YES");
	return 0;
}

Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;
long long N,P;
//priority_queue<long long> Q;
long long ans=1;

long long pow1(long long a,long long b){
  long long ans=1;
  if(b==0){
    return 1;
  }
  else{
    for(long long i=0;i<b;i++){
      ans = a*ans;
      //ans%=1000000007;//これでいい
    }
    return ans;
  }
}
int main(){
  cin >> N >> P;
  long long i=2;
  long long cnt=0;
  if(N==1) cout << P << endl;
  else{
    while(P>1){
      if(i>sqrt(P)+1) break;
      while(P%i==0){
        P=P/i;
        //num[i]++;
        cnt++;

        //cout << P << endl;
      }

      if(cnt>=N){
        ans*=pow1(i,cnt/N);
        //ans*=i;
        //Q.push(i);
        //cout << i << endl;
        //return 0;
      }
      i++;
      cnt=0;
    }

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


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

int main() {
	const int K = 42;
	const int N = K * (K - 1) + 1;
	ios::sync_with_stdio(false);
	cout.tie(0);
	cout << N << " " << K << '\n';
	for (int i = 2; i <= N; i += K - 1) {
		cout << 1;
		for (int j = 0; j < K - 1; j++) {
			cout << " " << i + j;
		}
		cout << '\n';
	}
	int M = K - 1;
	for (int i = 2; i <= K; i++) {
		int d = i - 2;
		for (int r = 0; r < K - 1; r++) {
			int p = r;
			cout << i;
			for (int s = K + 1; s <= N; s += K - 1) {
				cout << " " << (s + p);
				((p += d) >= M) && (p -= M);
			}
			cout << '\n';
		}
	}
	return 0;
}


Measured memory_bytes: 512
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
#import itertools
#import heapq
#from collections import deque
#d = deque()

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    ss=readline().rstrip()
    if ss[-1]=="s":
        print(ss+"es")
    else:
        print(ss+"s")
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 16156
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int i;
    int list[10];
    for(i=0;i<10;i++){
        cin >> list[i];
    }
    sort(list,list+10);
    for(i=0;i<3;i++){
        cout << list[9-i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3088
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == k:
    print(1)
elif n-k<=k:
    print(2)
else:
    if (n-k)%(k-1) == 0:
        print((n-k)//(k-1)+1)
    else:
        print((n-k)//(k-1)+2)

Measured memory_bytes: 14008
//using System;
//class p0003
//{
//    static void Main(string[] args)
//    {
//        int cnt = int.Parse(Console.ReadLine());
//        while (0 < cnt--)
//        {
//            var ary = Console.ReadLine().Split(' ');
//            Array.Sort(ary);
//            var x = (int)Math.Pow(double.Parse(ary[0]), 2);
//            var y = (int)Math.Pow(double.Parse(ary[1]), 2);
//            var z = (int)Math.Pow(double.Parse(ary[2]), 2);
//            Console.WriteLine((x + y == z) ? "YES" : "NO");
//        }
//    }
//}


using System;

class p0003
{

    static void Main(string[] args)
    {
        string[] s;
        int[] a = new int[3];


        int n = int.Parse(Console.ReadLine());

        while (0 < n--)
        {
            s = Console.ReadLine().Split(' ');
            for (int i = 0; i < 3; ++i)
            {
                a[i] = int.Parse(s[i]);
                a[i] = a[i] * a[i];
            }
            Console.WriteLine("{0}", ((a[0] == a[1] + a[2] || a[1] == a[0] + a[2] || a[2] == a[0] + a[1]) ? "YES" : "NO"));
        }

    }
    
}

Measured memory_bytes: 5456
def main
  _ = ARGF.gets
  nums = ARGF.gets.split.map(&:to_i)

  magic_cnt = 0
  last = -1
  nums.each do |n|
    if last == -1
      last = n
    elsif last == n
      magic_cnt += 1
      last = -1
    else
      last = n
    end
  end
  puts magic_cnt
end

if __FILE__ == $0
  main
end


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

#define ll long long

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int x = c-a , y = d-b;

    cout << c-y  << " " << d+x  << " " << a-y << " " << b+x;

}


Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

int main()
{

    int h,w,i,j;

    while(cin>>h>>w)
    {
        if(h==0 ||w== 0)
            return 0;
        for(i=1; i<=h; i++)
        {
            for(j=1; j<=w; j++)
            {
                if(i==1||j==1||h==i||w==j)
                    cout<<"#";
                else
                    cout<< ".";
            }
            cout<<endl;
        }
        cout<<endl;
    }

    return 0;
}



Measured memory_bytes: 3100
a1,a2,a3,_,*b = [i.split() for i in open(0)]
bingo = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [2, 5, 8], [0, 3, 6], [1, 4, 7], [0, 4, 8], [2, 4, 6]]
s = ["" if i in sum(b,[]) else i for i in a1 + a2 + a3]
for i,j,k in bingo:
    if {s[i],s[j],s[k]} ==  {''}:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 3064
# AOJ 1036: Monster Factory
# Python3 2018.7.6 bal4u

while True:
	in1 = list(input())
	if in1[0] == '-': break
	in2 = list(input())
	out = list(input())
	k = in2.pop(0)
	ans, f = '', True
	while len(in1) or len(in2):
		if len(out) and out[0] == k:
			k = in1.pop(0)
			del out[0]
		else:
			ans += k
			if len(in2): k = in2.pop(0)
			else:
				f = False
				break
	if f: ans += k
	print(ans)


Measured memory_bytes: 5560
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <bitset>

int main() {

    int N, tmp1, i = 0;
    long long ans = 0;

    std::cin >> N;
    long long A[N+1], B[N];
    while(std::cin >> tmp1){
        if(i<N+1){
            A[i] = tmp1;
        }else {
            B[i-(N+1)] = tmp1;
        }
        i++;
        if(i >= 2*N+1){
            break;
        }
    }

    for(int i=0; i<N; i++){
        if(A[i] <= B[i]){
            ans += A[i];
            B[i] = B[i] - A[i];
        }else{
            ans += B[i];
            B[i] = 0;
        }

        if(A[i+1] <= B[i]){
            ans += A[i+1];
            A[i+1] = 0;
        }
        else{
            ans += B[i];
            A[i+1] = A[i+1] - B[i];
        }
    }

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

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <sstream>
#include <fstream>
#include <cmath>
#include <stack>
#include <queue>
#include <list>
#include <map>

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;

#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define MIN(x, y) ( (x) < (y) ? (x) : (y) )
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define IVFOR(p,a) for(vector<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ILFOR(p,a) for(list<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define CHECK(x)  cout << #x << " = " << (x) << endl
#define FINA(y) cout << (y) << endl

int main(){

  string a, b, c;
  cin >> a >> b >> c;
  cout << 'A';
  cout << b[0];
  cout << 'C' << endl;

 return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
signed main(){
	int n,ans=0,z=0,vz;
	string s;
	bool bo=false;
	cin>>s>>n;
	f(i,(int)s.size()-1){
		if(s[i]!=s[i+1]){
			if(!bo&&s[0]==s[s.size()-1]){
				ans+=(i+1-z)/2;
				vz=i+1-z;
			}
			else ans+=(i+1-z)/2*n;
			bo=true;
			z=i+1;
		}
	}
	if(!bo)ans=((int)s.size()*n)/2;
	else if(s[0]==s[s.size()-1]){
		ans+=(vz+(int)s.size()-z)/2*(n-1);
		ans+=((int)s.size()-z)/2;
	}
	else ans+=((int)s.size()-z)/2*n;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)




int main() {
	int N;
	cin >> N;
	cout << setprecision(24) << (double)((N + 1) / 2) / N << endl;
}

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

int main() {
	int x1,y1,x2,y2,x,y,dx,dy;
	cin >> x1 >> y1 >> x2 >> y2;
	x = x2;
	y = y2;
	dx = x2 - x1;
	dy = y2 - y1;
	for(int i = 0; i < 2; i++){
		swap(dx,dy);
		dx = -dx;
		x += dx;
		y += dy;
		cout << x << " " << y << endl;
	}
	return 0;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7

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

def pow_mod(a, n):
    if n == 1:
        return a
    half = pow_mod(a, n // 2)
    if n % 2 == 1:
        ret = half * a % MOD
        ret = ret * half % MOD
    else:
        ret = half * half % MOD
    return ret

ans_dict = dict()
for g in range(k, 0, -1):
    ans_dict[g] = pow_mod(k // g, n)
    for i in range(2, k + 1):
        if g * i <= k:
            ans_dict[g] -= ans_dict[g * i]
            if ans_dict[g] < 0:
                ans_dict[g] += MOD
            elif ans_dict[g] > g:
                ans_dict[g] -= MOD
        else:
            break

ans = 0
for g, v in ans_dict.items():
    ans += g * v
    ans %= MOD

print(ans)


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const ll Inf = 1e15;
const double EPS = 1e-9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<vector<ll> > a(n, vector<ll>(n)), g(n, vector<ll>(n, Inf));
    ll res = 0;
    rep (i, n) {
        rep (j, n) {
            cin >> a[i][j];
            g[i][j] = a[i][j];
            if (i < j) res += a[i][j];
        }
    }
    rep (k, n) {
        rep (i, n) {
            rep (j, n) {
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }
    rep (i, n) {
        FOR (j, i + 1, n) {
            if (g[i][j] != a[i][j]) {
                cout << -1 << endl;
                return 0;
            }
            rep (k, n) {
                if (k == i || k == j) continue;
                if (a[i][j] == a[i][k] + a[k][j]) {
                    res -= a[i][j];
                    break;
                }
            }
        }
    }
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;
/**==Info==
*Program:1
*Problem:Shorten Diameter
*Date:2017-8-8
*Algorithm:DFS
*Stats:Unknown*/
int n,k;
vector<int> nei[2050];
int dis[2050][2050];
bool crash[2050][2050];
int cnum[2050];  //Crash Number
void bfs(int root){
	queue<int> q;
	dis[root][root]=0;
	q.push(root); 
	while(!q.empty()){
		int last=q.front();
		q.pop();
		for(int i=0;i<nei[last].size();i++){
			if(dis[root][nei[last][i]]==-1){
				dis[root][nei[last][i]]=dis[root][last]+1;
				q.push(nei[last][i]);
				//cout<<"Push yoU!"<<endl;
			}
		}
	}
}

bool nocrash(){
	for(int i=0;i<n;i++){
		if(cnum[i]>0) return false;
	}
	return true;
}
int main(){
	cin>>n>>k;
	for(int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		a--;b--;
		nei[a].push_back(b);
		nei[b].push_back(a);
	}
	
	//memset(dis,-1,2050*2050);
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			dis[i][j]=-1;
		}
	}
	for(int i=0;i<n;i++){
		bfs(i);
	}
	
//	for(int i=0;i<n;i++){
//		for(int j=0;j<n;j++){
//			cout<<dis[i][j]<<" ";
//		}
//		cout<<endl;
//	}
	//Find crash
	for(int i=0;i<n;i++){
		int num=0;
		for(int j=0;j<n;j++){
			if(dis[i][j]>k){
				crash[i][j]=true;
				num++;
			}
		}
		cnum[i]=num;
	}
	
//	cout<<"Oops"<<endl;
	
	int ans=0;
//			for(int i=0;i<n;i++){
//			cout<<cnum[i]<<" ";
//		}
//		cout<<endl;
		
	while(!nocrash()){
		//Find the biggest crasher!!!!
		int mx=-1,imx=-1;
		for(int i=0;i<n;i++){
			if(cnum[i]>mx){
				mx=cnum[i];
				imx=i;
			}
		}
		
		//Then Kill It
		for(int i=0;i<n;i++){
			 crash[imx][i]=false;
			 if(crash[i][imx]){
			 	crash[i][imx]=false;
			 	cnum[i]--;
			 }
		}
		cnum[imx]=-2;
		ans++;
		

	}
	cout<<ans;
	return 0;
}


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



void solve(){
    int n;
    long long int ans=0,a,b;
    scanf("%d",&n);

    for(int i=1;i<n;i++){
        for(int j=1;j<n;j++){
            if(i*j>=n) break;
            ans++;
        }
    }


    printf("%lld\n",ans);
}

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


Measured memory_bytes: 3840
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define mp make_pair;

const ll prime = 1000000000 + 7;
const ld PI = 2 * acos(0.0);

/*
cout << fixed << setprecision(10);
*/

bool my_comp(pll a, pll b) {
	if (a.first != b.first) {
		return a.first < b.first;
	}

	return a.second < b.second;
}

int main() {

	ll x;
	cin >> x;
	if (x >= 2100) {
		cout << "1" << endl;
		return 0;
	}
	for (ll i = 0; i < 22; i++)
	{
		if (100 * i <= x and x <= 105 * i) {
			cout << "1" << endl;
			return 0;
		}
	}

	cout << "0" << endl;

	return 0;
}


Measured memory_bytes: 256