akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pII;
#define pb push_back
#define mp make_pair
#define clr(x,y) memset(x,y,sizeof(x))
const int inf=0x3f3f3f3f;
const ll mod=1e9+7;
const int maxn=1e6+5;
//ll fmod(ll x,ll y){ll res=1;while(y){if(y&1)res=res*x%mod;y>>=1;x=x*x%mod;}return res;}
//ll gcd(ll x,ll y){return y==0?x:gcd(y,x%y);}
int a[105];
int main()
{
   int n;
   while(cin>>n)
   {
       if(n == 0)
       {
           cout<<0<<endl;
           continue;
       }

       clr(a,0);
       int cnt = 0;
       while(abs(n))
       {
           a[++cnt] = abs(n)%(2);
           int now = n;
           int p = n/(-2);
           now -= (-2)*p;
           //cout<<p<<endl;

           if(now < 0)
           {
               if(p < 0)
               p--;
               else
                p++;
           }
           n = p;
       }
       for(int i = cnt; i >= 1; --i)
        cout << a[i];
       cout<<endl;
   }
}
















Measured memory_bytes: 256
N,K = map(int,input().split())
p = list(map(int,input().split()))

#累積和を使う
e_s = [0] * (N+1)
for i in range(N):
    # 期待値の計算
    e = (p[i]+1)/2
    e_s[i+1] = e_s[i] + e

ans = 0
for j in range(N-K+1):
    ans = max(ans,e_s[j+K]-e_s[j])
print(ans)


Measured memory_bytes: 32228
#include<iostream>
#include<algorithm>
#include<vector>

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

int main(){
    int turai=0;
    while(1){
        int A;
        cin>> A;
        if(!A) break;

        int hoge[]={10, 50, 100, 500};
        int geho[4];
        for(int i=0; i<4; i++) cin>> geho[i];

        int a[4]={0};
        int mimi=100;
        int s=accumulate(geho, geho+4, 0);
        rep(i, geho[0])rep(j, geho[1])rep(k, geho[2])rep(l, geho[3]){
            int harau=i*10+j*50+k*100+l*500;
            if(harau<A) continue;
            int oturi=harau-A;
            int b[4]={0};
            int Oturi=oturi;
            for(int ii=3; ii>=0; ii--){
                b[ii]=Oturi/hoge[ii];
                Oturi%=hoge[ii];
            }
            int ng=0;
            int c[4]={i, j, k, l};
            for(int ii=0; ii<4; ii++){
                if(b[ii]&&c[ii]) ng=1;
            }
            if(ng) continue;
            int t=accumulate(b, b+4, 0);
            int tukawanai=s-(i+j+k+l);
            if(tukawanai+t<mimi){
                a[0]=i; a[1]=j;
                a[2]=k; a[3]=l;
                mimi=tukawanai+t;
            }
        }

        if(turai!=0){cout<< endl;}
        turai++;
        for(int i=0; i<4; i++){
            if(a[i]) cout<< hoge[i]<< " "<< a[i]<< endl;
        }
    }


    return 0;
}

Measured memory_bytes: 2992
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int m1,d1,m2,d2;
    m1=sc.nextInt();
    d1=sc.nextInt();
    m2=sc.nextInt();
    d2=sc.nextInt();
    if(m1!=m2){
      System.out.println(1);
    }else{
      System.out.println(0);
    }
  }
}

Measured memory_bytes: 23636
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
for i, b in enumerate(B):
	count += min(A[i], b)
	b -= A[i]
	if b > 0:
		x = min(A[i + 1], b)
		A[i + 1] -= x
		count += x
print(count)

Measured memory_bytes: 82020
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
int vals[100001][4];// if don't have, is 0
set<int> axisx;
set<int> axisy;
bool vis[100001] = {false};
pair<int, int> coords[100001];
int cnt = 0;
void dfs(int node){
    if (vis[node]){
        return;
    }
    cnt++;
    axisx.insert(coords[node-1].first);
    axisy.insert(coords[node-1].second);
    vis[node] = true;
    for (int i=0; i<4; i++){
        if (vals[node][i]){
            dfs(vals[node][i]);
        }
    }
}
int main ()
{
  prep();
  int n;
  cin >> n;
  set<pair<int, int> > xs[100001];
  set<pair<int, int> > ys[100001];
  
  set<int> xvals;
  set<int> yvals;
  for (int i=0; i<n; i++){
      int a, b;
      cin >> a >> b;
      xs[b].insert({a, i});
      ys[a].insert({b, i});
      coords[i] = {a, b};
      xvals.insert(a);
      yvals.insert(b);
  }

  // L, R, U, D
  for (int i : xvals){
      set<pair<int, int> >::iterator it = ys[i].begin();
      int last = (*it).second;
      it++;
      while (it != ys[i].end()){
          int cur = (*it).second;
          vals[last+1][1] = cur+1;
          vals[cur+1][0] = last+1;
          last = cur;
          it++;
      }
  }
  for (int i : yvals){
      set<pair<int, int> >::iterator it = xs[i].begin();
      int last = (*it).second;
      it++;
      while (it != xs[i].end()){
          int cur = (*it).second;
          vals[last+1][2] = cur+1;
          vals[cur+1][3] = last+1;
          last = cur;
          it++;
      }
  }
  
  // find L shape
  long long res = 0;
  for (int i=1; i<=n; i++){
      if (vis[i]){
          continue;
      }
      if (vals[i][0] && vals[i][2] || vals[i][0] && vals[i][3] || vals[i][1] && vals[i][2] || vals[i][1] && vals[i][3]){
          
      }else{
          continue;
      }
      axisx.clear();
      axisy.clear();
      cnt = 0;
      dfs(i);
      //cout << cnt << endl;
      res += (long long)axisx.size()*axisy.size()-cnt;
  }
  cout << res;
  return 0; 
}


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

int main(){
  	int N;
  	cin >> N;
  	vector<int> A(N);
  	
  	for(int i=0; i<N; i++){
    	cin >> A[i];
    }
  
  	sort(A.begin(),A.end());
  	for(int i=0; i<N-1; i++){
        if(A[i]==A[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
  
  	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 1024
H = int(input())
W = int(input())
N = int(input())

black = 0
result = 0
while black < N:
    if W < 0 or H < 0:
        print('error. W and H should be more tham 0')
        break

    if H > W:
        black += H
        W -= 1
    else:
        black += W
        H -= 1
    result += 1

print(result)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += s.substr(i, 3) == "ABC";
  }
  kek(ans);
}


Measured memory_bytes: 256
def warshall_floyd(G):
    import copy
    ret = copy.deepcopy(G)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                ret[i][j] = min(ret[i][j], ret[i][k] + ret[k][j])
    return ret


INF = 10 ** 10
N, M, L = map(int, input().split())

G = [[INF] * N for _ in range(N)]
for i in range(M):
    A, B, C = map(int, input().split())
    G[A - 1][B - 1], G[B - 1][A - 1] = C, C

MinG = warshall_floyd(G)
GL = [[1 if MinG[i][j] <= L else INF for j in range(N)] for i in range(N)]
MinGL = warshall_floyd(GL)

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    print(-1 if MinGL[s - 1][t - 1] == INF else MinGL[s - 1][t - 1] - 1)


Measured memory_bytes: 73304
#include<bits/stdc++.h>
using namespace std;
int main(){
    long int N, sum;
    sum = 0;
    cin >> N;
    vector<int> vec(N);

    for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    sum += vec.at(i);
    }
    sort(vec.begin(), vec.end());
    cout << vec.at(0) << " " << vec.at(N-1) << " " << sum << endl;
}


Measured memory_bytes: 3184
import java.io.*;
import java.util.*;
@SuppressWarnings("unused")
public class Main{
    static long val[];
    static int wt[];
    public static void main(String args[]) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        String s[] = br.readLine().trim().split(" ");
        int n = Integer.parseInt(s[0]);
        int w = Integer.parseInt(s[1]);
        val = new long[n];
        wt = new int[n];
        for(int i=0;i<n;i++) {
            String st[] = br.readLine().trim().split(" ");
            wt[i] = Integer.parseInt(st[0]);
            val[i] = Integer.parseInt(st[1]);
        }
        long[] dp = new long[w+1];
        for(int i=0;i<n;i++) {
            for(int j=w;j>=wt[i];j--) {
                dp[j] = Math.max(dp[j], dp[j-wt[i]]+val[i]);
            }
        }
        out.println(dp[w]);
        out.flush();
    }
}

Measured memory_bytes: 34652
#include<bits/stdc++.h>
using namespace std;
using ld = long double;

int main(){
  int a,b,x,y;
  cin>>a>>b>>x>>y;
  cout<<(double)a*(double)b/2.0<<" ";
  if(x+x==a&&y+y==b){
    cout<<1<<endl;
  }else{
    cout<<0<<endl;
  }
  return 0;
}

Measured memory_bytes: 3788
import math
from fractions import gcd
a, b = map(int, input().split())
g = gcd(a, b)
sqrt = math.floor(g ** 0.5)
factors = [1]
z = g
for i in range(2, sqrt + 1):
    if not z % i:
        factors.append(i)
        while z % i == 0:
            z //= i
if z > 1:
    factors.append(z)
print(len(factors))


Measured memory_bytes: 5044
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque

h,w=nii()
ch,cw=nii()
dh,dw=nii()
s=[list(input()) for i in range(h)]

ch-=1
cw-=1
dh-=1
dw-=1

ans=[[-1]*w for i in range(h)]
ans[ch][cw]=0

que=deque()
que.append((ch,cw))

while que:
  y,x=que.popleft()

  if y==dh and x==dw:
    print(ans[y][x])
    exit()

  for dy,dx in [[-1,0],[1,0],[0,-1],[0,1]]:
    ny=y+dy
    nx=x+dx
    if 0<=ny<h and 0<=nx<w and s[ny][nx]!='#':
      que.appendleft((ny,nx))
      s[ny][nx]='#'
      ans[ny][nx]=ans[y][x]

  for i in range(-2,3):
    for j in range(-2,3):
      ny=y+i
      nx=x+j
      if 0<=ny<h and 0<=nx<w and s[ny][nx]!='#' and ans[ny][nx]==-1:
        que.append((ny,nx))
        ans[ny][nx]=ans[y][x]+1

print(-1)

Measured memory_bytes: 133424
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int H, W;
	scanf("%d", &H);
	scanf("%d", &W);

	int dp[1001];
	dp[0] = 1;
	char A[1001];
	scanf("%s", A);
	rep1(w, W - 1) dp[w] = (A[w] == '.' ? dp[w - 1] : 0);

	rep1(h, H - 1) {
		scanf("%s", A);
		dp[0] = (A[0] == '.' ? dp[0] : 0);
		rep1(w, W - 1) {
			dp[w] = (A[w] == '.' ? (dp[w] + dp[w - 1]) % mod : 0);
		}
	}
	printf("%d", dp[W - 1]);

	Would you please return 0;
}

Measured memory_bytes: 128
n, D = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(n)]
res = 0
for i in range(n):
    for j in range(i + 1, n):
        d = sum((l[i][k] - l[j][k]) ** 2 for k in range(D))
        if int(d ** 0.5) ** 2 == d:
            res += 1
print(res)

Measured memory_bytes: 3188
package main
import (
  "bufio"
  "fmt"
  "math"
  "os"
  "sort"
  "strconv"
  "strings"
)

const size = 1000000
var reader = bufio.NewReaderSize(os.Stdin,size)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextStringArray() []string {
  return strings.Split(NextLine()," ")
}
func NextIntArray() []int {
  var s []string = strings.Split(NextLine()," ")
  var n int = len(s)
  var a []int = make([]int,n)
  for i:=0;i<n;i++ {
    a[i],_ = strconv.Atoi(s[i])
  }
  return a
}

func main() {
  var n,b,ans int
  var a []int
  n,_ = strconv.Atoi(NextLine())
  a = NextIntArray()
  for i:=0;i<n;i++ { a[i] -= i+1 }
  sort.Ints(a)
  b = nint(a[n/2]+a[n-(n+1)/2],2)
  ans = 0
  for i:=0;i<n;i++ { ans += abs(a[i]-b) }
  fmt.Println(ans)
}
func nint(n int,m int) int {
  var f float64 = float64(n)/float64(m)
  return int(math.Floor(f+0.5))
}
func abs(n int) int {
  if n < 0 { return -n }
  return n
}

Measured memory_bytes: 12032
N, M = map(int, input().split())
l = [0] * (N+1)
for i in range(M):
  a, b = map(int, input().split())
  l[a] += 1
  l[b] += 1
  
flag = True
for i in range(N+1):
  if l[i] % 2 == 1:
    flag = False
    break
if flag:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 9656
S = input()
A = [int(c) for c in S]

l = len(S)
L = [[0 for j in range(l + 1)] for i in range(2)]
R = [[0 for j in range(l + 1)] for i in range(2)]

for i in range(l):
    L[0][i + 1] = L[0][i]
    L[1][i + 1] = L[1][i]
    L[A[i]][i + 1] += 1

for i in range(l - 1, -1, -1):
    R[0][i] = R[0][i + 1]
    R[1][i] = R[1][i + 1]
    R[A[i]][i] += 1

k = 0
for a, b, c, d in zip(L[0], R[1], L[1], R[0]):
    k = max(k, min(a, b) + min(c, d))

print(k * 2)





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

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

    static class A {
        public void solve(int testNumber, InputReader sc, PrintWriter out) {
            String s = sc.next();
            boolean isa = false, isb = false;
            for (int i = 0; i < s.length(); i++) {
                if (s.charAt(i) == 'A')
                    isa = true;
                else
                    isb = true;
            }
            if (isa && isb)
                out.println("Yes");
            else
                out.println("No");

        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 21460
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string s = Console.ReadLine();
        int[,] D = new int[20,s.Length];
        D[0,s.Length-1] = s.Length;
        {
            int[,] DP = new int[s.Length,26];
            for(int i=0;i<26;i++){
                DP[s.Length-1,i] = (s[s.Length-1]-'a') == i ? s.Length-1 : s.Length;
            }
            for(int i=s.Length-2;i>=0;i--){
                int c = (s[i]-'a');
                DP[i,c] = i;
                for(int j=1;j+c<26;j++){
                    DP[i,j+c] = DP[i,j+c-1] >= s.Length-1 ? s.Length : DP[DP[i,j+c-1]+1,j+c-1];  
                }
                D[0,i] = DP[i,25] >= s.Length-1 ? s.Length : DP[DP[i,25]+1,25];
                for(int j=0;j<c;j++){
                    DP[i,j] = D[0,i] >= s.Length-1 ? s.Length : DP[D[0,i]+1,j]; 
                }
            }
        }
        for(int i=1;i<20;i++){
            for(int j=0;j<s.Length;j++){
                D[i,j] = D[i-1,j] >= s.Length-1 ? s.Length : D[i-1,D[i-1,j]+1];
            }
        }
        int Q = int.Parse(Console.ReadLine());
        for(int i=0;i<Q;i++){
            string[] str = Console.ReadLine().Split(' ');
            int l = int.Parse(str[0])-1;
            int r = int.Parse(str[1])-1;
            for(int j=19;j>=0;j--){
                if(l != s.Length && D[j,l] <= r){
                    l = D[j,l]+1;
                }
            }
            sb.Append(l-1 == r ? "Yes\n" : "No\n");
        }
    }
}

Measured memory_bytes: 107712
N = int(input())
A = map(int,input().split())
dict = {
    1: 0,
    2: 0,
    3: 0,
    4: 0,
    5: 0,
    6: 0,
    7: 0,
    8: 0,
    0: 0
}

for a in A:
    if a < 400:
        dict[1] = 1
    elif a < 800:
        dict[2] = 1
    elif a < 1200:
        dict[3] = 1
    elif a < 1600:
        dict[4] = 1
    elif a < 2000:
        dict[5] = 1
    elif a < 2400:
        dict[6] = 1
    elif a < 2800:
        dict[7] = 1
    elif a < 3200:
        dict[8] = 1
    else:
        dict[0] += 1

min_c = 0
max_c = 0
for i in range(1, 9):
    if dict[i] > 0:
        min_c += 1
        max_c += 1

v = dict[0]
if v > 0:
    max_c += v
    if min_c == 0:
        min_c = 1

print(min_c, max_c)


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

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> v(m);
    for(int i = 0; i < n; ++i) {
        int a, b; cin >> a >> b;
        if(m - a >= 0) {
            v[m - a].push_back(b);
        }
    }

    priority_queue<int, vector<int>, greater<>> que;
    int ans = 0;
    for(int i = 0; i < m; ++i) {
        sort(v[i].begin(), v[i].end(), greater<int>{});
        for(int j = 0; j < min((int)v[i].size(), i + 1); ++j) {
            const int val = v[i][j];
            ans += val;
            que.push(val);
        }
        while((int)que.size() > i + 1) {
            ans -= que.top();
            que.pop();
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6140
import itertools

n = int(input())

p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

a = list(itertools.permutations(range(1, n+1))).index(p)
b = list(itertools.permutations(range(1, n+1))).index(q)

print(abs(a-b))


Measured memory_bytes: 8052
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

long long pow(const long long &v, const long long &n, const long long &mod)
{
    long long ret = 1;
    long long num = n;
    long long now = v;
    
    while (num > 0)
    {
        if (num & 1)
        {
            ret = ret * now % mod;
        }
        now = now * now % mod;
        num = num >> 1;
    }
    
    return ret;
}

long long calc(const long long &n, const long long &k, const long long &mod)
{
    long long ret;
    vector<ll> fac = vector<long long>(n + 1, 1);
    vector<ll> inv = vector<long long>(n + 1, 1);
    
    for (int i = 1; i <= n; ++i)
    {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = pow(fac[i], mod - 2, mod);
    }
    
    ret = fac[n] * inv[k] % mod * inv[n - k] % mod;
    
    return ret;
}

const int mod = 1e9 + 7;

int main() {
    

    
    ll n, m, k;
    cin >> n >> m >> k;
    
    ll ret = 0;
    for (int i = 1; i <= n - 1; ++i)
    {
        ret += ((((n - i) * m) % mod) * m % mod) * i % mod;
        ret %= mod;
    }
    
    
    for (int i = 1; i <= m - 1; ++i)
    {
        ret += ((((m - i) * n) % mod) * n % mod) * i % mod;
        ret %= mod;
    }
    
    ll comb = calc(n * m - 2ll, k - 2, mod);
    
    cout << (ret * comb) % mod << endl;
    
    return 0;
}

Measured memory_bytes: 3328
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            int? a = null;
            string Result = string.Empty;


            string Input = System.Console.ReadLine();

            string[] Data = Input.Split(' ');

            foreach(var setData in Data)
            {
                if (a == null)
                {
                    a = int.Parse(setData);
                    continue;
                }

                else
                {


                    int b = int.Parse(setData);

                    if(a == b)
                    {
                         Result = "a == b";
                    }

                    if(a > b)
                    {
                        Result = "a > b";

                    }

                    if(a < b)
                    {
                        Result = "a < b";
                    }

                    Console.WriteLine("{0}", Result);
                }


            }

        }
    }
}

Measured memory_bytes: 8984
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))



def do():
    def cmb(n, r, mod):
        if ( r<0 or r>n ):
           return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % mod

    n,k=INTM()
    r=n-k
    b=k

    N = n
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル

    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    for i in range(1,b+1):
        t1=cmb(r+1,i,mod)
        t2=cmb(b-1,i-1,mod)
        print((t1*t2)%mod)

if __name__=='__main__':
    do()

Measured memory_bytes: 68760
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        String strInput = input.nextLine();
        String[] str = new String[5];
        str = strInput.split(" ");
        int w = Integer.parseInt(str[0]);
        int h = Integer.parseInt(str[1]);
        int x = Integer.parseInt(str[2]);
        int y = Integer.parseInt(str[3]);
        int r = Integer.parseInt(str[4]);
        if(x+r > w){
            System.out.println("No");
        }else if(x-r<0){
            System.out.println("No");
        }else if(y+r>h){
            System.out.println("No");
        }else if(y-r<0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 26364
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

a,b = LI()

ans1 = ''
ans2 = ''
for i in range(b):
    ans1 += str(a)
for i in range(a):
    ans2 += str(b)

if ans1 < ans2:
    print(ans1)
else:
    print(ans2)

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

ll RepeatSquaring(ll n, ll P){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(n, P/2);
        return t*t % MOD;
    }
    return n * RepeatSquaring(n, P-1) % MOD;
}

ll mod(ll val) {
    ll res = val % MOD;
    if (res < 0) res += MOD;
    return res;
}

int main() {
    ll N,K;
    cin >> N >> K;
    vector<ll> cnt(K + 1);
    for(ll i = K;i >= 1;i--) {
        ll cnt2 = RepeatSquaring(K / i,N);
        for(ll j = 2;i * j <= K;j++) {
            cnt2 = mod(cnt2 - cnt.at(i * j));
        }
        cnt.at(i) = cnt2;
    }
    ll ret = 0;
    for(ll i = 1;i <= K;i++) {
        ret += (i * cnt.at(i) % MOD);
        ret %= MOD;
    }
    cout << ret << endl;
}

Measured memory_bytes: 4052
#include <iostream>
#include <cstdio>
#include <map>
#include <queue>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
void read(int &x){
	char c=getchar();
	int k=1;
	while(c<'0'||c>'9') {if(c=='-') k=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
	x=x*10+c-'0';
	x*=k;
}
int a,b;
int main(){
	cin>>a>>b;
	if(a*b==15) printf("*");
	else if(a+b==15) printf("+");
	else printf("x"); 
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
 
int main() {
   
  int n;
  int a[10001];
 
  while( cin >> n && n ) {

   
    for(int i=0; i<n; i++) {
      cin >> a[i];
    }
     
    bool ok = false;
    for(int i=0; i<n; i++) {
      if(a[i]-2>=0) ok = true;
    }
     
    int cnt = 0;
    if(ok) {
      for(int i=0; i<n; i++)
    if(a[i]>0) cnt ++;
      cout << cnt + 1 << endl;
    } else {
      cout << "NA" << endl;
    }
  }
     
  return 0;
}

Measured memory_bytes: 1200
n = int(input())
d_li = list(map(int,input().split()))
m = int(input())
t_li = list(map(int,input().split()))

d_li.sort()
t_li.sort()

check = 0

for i in range(n):
    if d_li[i] == t_li[check]:
        check += 1
        
    if check == m:
        print("YES")
        exit()
else:
    print("NO")
    

Measured memory_bytes: 35420
S = input()
mod = 10**9+7
N = len(S)

dp = [[0 for _ in range(13)] for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(13):
        if S[i] == '?':
            for k in range(10):
                dp[i+1][(j*10+k)%13] += dp[i][j]
                dp[i+1][(j*10+k)%13] %= mod
        else:
            dp[i+1][(j*10+int(S[i]))%13] += dp[i][j]
            dp[i+1][(j*10+int(S[i]))%13] %= mod

print(dp[N][5])


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

int main(){
  int N;
  string s;
  cin >> N >> s;
  
  int countr = 0;
  int countb = 0;
  for(int i = 0; i < N; i++){
    if(s[i] == 'R'){
      countr++;
    }else{
      countb++;
    }
  }
  if(countr > countb){
    cout << "Yes" << endl;;
  }else{
    cout << "No" << endl;
  }
  
  
  
  return 0;
}

Measured memory_bytes: 256
function getLineByParam( param ){
  var ret;
  for ( var i=0; i<param[0].length; i++ ) {
    if ( "\n" == param[0].charAt( i ) ) {
      ret = param[0].slice( 0, i );
      param[0] = param[0].slice( ret.length+1 );
      return ret;
    }
  }
  ret = param[0];
  param[0]="";
  return ret;
}

function Main(input) {
  input = [input];
  var tmp = getLineByParam(input).split(" ");
  var A = parseInt( tmp[0] );
  var B = parseInt( tmp[1] );
  var C = parseInt( tmp[2] );
  if ( A === B ) {
    console.log( C );
  }
  else if ( A === C ) {
    console.log( B );
  }
  else if ( B === C ) {
    console.log( A );
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	s := scanRunes()
	t := scanRunes()

	ss := map[rune]rune{}
	tt := map[rune]rune{}

	for i := 0; i < len(s); i++ {
		if _, ok := ss[s[i]]; !ok {
			ss[s[i]] = t[i]
		}
		if _, ok := tt[t[i]]; !ok {
			tt[t[i]] = s[i]
		}
		if ss[s[i]] != t[i] || tt[t[i]] != s[i] {
			fmt.Fprintln(wr, "No")
			return
		}
	}
	fmt.Fprintln(wr, "Yes")

}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000

int main() {
    long long A[MAX+1], B[MAX+1];
    int N;

    cin >> N;
    for (int i=0; i<=N; i++) {
        cin >> A[i];
    }
    for (int i=0; i<N; i++) {
        cin >> B[i];
    }

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

    printf("%lld", sum);
    
    return 0;
}

Measured memory_bytes: 1792
<?php
fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $d);

while (true) {
  $c -= $b;
  vit_check($c, 'Yes');
  $a -= $d;
  vit_check($a, 'No');
}

function vit_check($vit, $result)
{
  if ($vit <= 0) {
    echo $result;exit;
  }
}


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

using namespace std;

typedef long long ll;

const ll inf = 1LL << 60;

int w[110], v[110];
ll dp[100010];

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

    int n, W;
    cin >> n >> W;

    int V = 0;

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

        V += v[i];
    }

    ///dp[v] = minimum weight that i can achieve with value = v

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

    for(int i = 0; i < n; i++) {
        for(int j = V - v[i]; j >= 0; j--) {
            dp[j + v[i]] = min( dp[j + v[i]], dp[j] + w[i] * 1LL );
        }
    }

    int ans = 0;

    for(int i = 0; i <= V; i++) {
        if(dp[i] <= W) {
            ans = i;
        }
    }

    cout << ans << endl;
}

/*
 * E
**/


Measured memory_bytes: 1024
/**
**	author : Raghav
**	codechef:raghav_456
**	codeforces:raghavramola7
**/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define endl 			"\n"
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void Raghav()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(100);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	Raghav();
	/*map<string, int>m;
	string s;
	w(t)
	{
		cin >> s;
		m[s]++;
	}
	cout << "AC * " << m["AC"] << endl;
	cout << "WA * " << m["WA"] << endl;
	cout << "TLE * " << m["TLE"] << endl;
	cout << "RE * " << m["RE"] << endl;*/
	int n;
	cin>>n;
	cout<<(1000-n%1000)%1000;

	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define md 1000000007
string s;
int dp[10009][100][2],p,d;
inline int dfs(int n,int z,bool f){
	if(n==s.size()) return !z;
	int &res(dp[n][z][f]);
	if(~res) return res;
	res=0;
	int x=s[n]-'0';
	int r=(f?x:9);
	for(int i=0;i<=r;++i){
    	res+=dfs(n+1,(z+i)%d,f and i==r);
    	if(res>=md) res-=md;
	}
	return res;
}
int main(){
	memset(dp,-1,sizeof(dp));
	cin>>s>>d;
	cout<<(dfs(0,0,1)-1+md)%md<<endl;
}

Measured memory_bytes: 8832
import math
k=int(input())
if k%7==0:k//=7
if math.gcd(10,k)!=1: exit(print(-1))
if k==1: exit(print(1))
v=1
ans=0
while(v!=0):
    v=(v*10+1)%k
    ans+=1 
print(ans+1)

Measured memory_bytes: 9204
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	n, k = tin()
	#s = input()
	al = lin()
	al.sort()
	ret = sum(al[:k])
	print(ret)
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 9232
n, m = map(int, input().split())
l0, r0 = map(int, input().split())
for i in range(m - 1):
    l, r = map(int, input().split())
    l0 = max(l0, l)
    r0 = min(r0, r)
print(max(0, r0 - l0 + 1))

Measured memory_bytes: 3060
/**
*    author:  y_takano
*    created: 18.06.2020 15:11:04
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int i, j;
  cin >>  i >> j;

  cout << i * j << " " << i * 2 + j * 2 << "\n";
  
  return 0;
}


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


#define ll long long
#define pb push_back
#define mp make_pair
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 1e9+7;
const int inf = 2e18+5;


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

  ll n;
  cin>>n;
  int abc[n][3];
  int dp[n][3];
  memset(dp,-1,sizeof(dp));

  loop(i,0,n)
    cin>>abc[i][0]>>abc[i][1]>>abc[i][2];
  loop(i,0,3)
    dp[0][i]=abc[0][i];

  loop(i,0,n-1){
    loop(j,0,3){
      dp[i+1][(j+1)%3]=max(dp[i+1][(j+1)%3] , dp[i][j]+abc[i+1][(j+1)%3]);
      dp[i+1][(j+2)%3]=max(dp[i+1][(j+2)%3] , dp[i][j]+abc[i+1][(j+2)%3]);
    }
  }

  cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
  return 0;
}


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

int ans,n,m,x,y,z,a[111][111],used[111];


void dfs(int d,int b){
  if(d==n){
    int res=0;
    if(b<2)return;
    r(i,b){
      int A=1e9;
      r(j,b)if(i!=j){
        A=min(A,a[used[i]][used[j]]);
      }
      res+=A;
    }
    ans=max(ans,res);
    return;
  }
  int f=1;
  r(i,b)if(a[d][used[i]]==0)f=0;
  if(f){
    used[b]=d;
    dfs(d+1,b+1);
  }
  dfs(d+1,b);
}

int main(){
  cin>>n>>m;
  r(i,m){
    cin>>x>>y>>z;
    x--;y--;
    a[x][y]=a[y][x]=z;
  }
  dfs(0,0);
  cout<<ans<<endl;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int n, m, X, Y; cin >> n >> m >> X >> Y;
  vi x(n), y(m);
  REP(i, n) cin >> x[i];
  REP(i, m) cin >> y[i];
  sort(ALL(x));
  reverse(ALL(x));
  sort(ALL(y));
  if(X <= x[0] && y[0] <= Y && y[0] - x[0] > 0) cout << "No War" << endl;
  else cout << "War" << endl;
}


Measured memory_bytes: 256
object Main extends App {
  val n = readInt
  val bs = readLine.split(" ").map(_.toInt) :+ 100007
  println( bs.scanLeft((100007,100007))((acc,x) => (x, math.min(acc._1,x)))
            .foldLeft(-100007)((acc,x) => acc+x._2) )
}

Measured memory_bytes: 25548
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        int[] d = new int[n];
        for(int i=0;i<n;i++){
            x[i]=scn.nextInt();
        }
        double dx1=0;
        double dx2=0;
        double dx3=0;
        double max = 0;
        for(int i=0;i<n;i++){
            y[i]=scn.nextInt();
            d[i]=Math.abs(x[i]-y[i]);
            max = Math.max(max,d[i]);

            dx1 +=d[i];
            dx2 +=Math.pow(d[i],2);
            dx3 +=Math.pow(d[i],3);
        }

        double dxy2 = Math.sqrt(dx2);
        double dxy3 = Math.cbrt(dx3);

        System.out.printf("%.6f%n",dx1);
        System.out.printf("%.6f%n",dxy2);
        System.out.printf("%.6f%n",dxy3);
        System.out.printf("%.6f%n",max);

        scn.close();

    }

}


Measured memory_bytes: 26872
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
#define MAXN 1000100
#define ll long long
ll x, y, z, a[MAXN], n, m, sum, flag;
int main()
{
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]), sum += a[i];
	sort(a+1,a+n+1);
	for(int i=n;i>=n-m+1;i--)
	{
		if(a[i]*4*m < sum)
			flag = 1;
	}
	if(flag == 0) printf("Yes\n");
	else printf("No\n");

	return 0;
}

Measured memory_bytes: 256
<?php
  list($n,$m) = explode(" ", trim(fgets(STDIN)));
  $city = [];
  $p = [];
  $y = [];
  for ($i=0; $i<$m; $i++) {
    list($p[$i],$y[$i]) = explode(" ", trim(fgets(STDIN)));    
    $city[$y[$i]]=$p[$i];
  }
  ksort($city);
  $pref=[];
  $prefcnt=[];
  foreach($city as $key => $val){
    if(!isset($pref[$val])) {
      $pref[$val] = [];
      $prefcnt[$val] = 0;
    }
    $prefcnt[$val]++;
    $pref[$val][$key]=$prefcnt[$val];
  }

  for ($i=0; $i<$m; $i++) {
    echo str_pad($p[$i],6,"0",STR_PAD_LEFT);
    echo str_pad($pref[$p[$i]][$y[$i]],6,"0",STR_PAD_LEFT);
    echo PHP_EOL;
  }
    


Measured memory_bytes: 75948
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
t=0
x=0
y=0
flag=True
for i in range(n):
    tt=l[i][0]-t
    d=abs(l[i][1]-x)+abs(l[i][2]-y)
    if tt<d or tt%2!=d%2:
        flag=False
    t=l[i][0]
    x=l[i][1]
    y=l[i][2]
if flag:
    print("Yes")
else:
    print("No")


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

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

}

cout<<"NG"<<endl;

  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

using namespace std;

int ans;
int x[4];

int main(void) {
    scanf("%d %d %d", &x[0], &x[1], &x[2]);
    sort(x, x + 3);
    
    printf("%d\n", x[2] * 10 + x[1] + x[0]);

	return 0;
}


Measured memory_bytes: 256
n, y = map(int, input().split(' '))

flag=0
for i in range(n+1):
  for j in range(n+1-i):
    if i*10000 + j*5000 + (n-i-j)*1000 == y:
      print(str(i)+' '+str(j)+' '+str(n-i-j))
      flag=1
      break
  if flag==1:
    break
       
if flag==0:
  print('-1 -1 -1')

Measured memory_bytes: 9020
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]

h, n = map(int, input().split())
abc = []

for _ in range(n):
    a, b = map(int, input().split())
    c = a / b
    abc.append((c, a, b))

abc.sort(reverse=True)

dp = [0] * (h + 1)

c, a, b = abc[0]
temp = a
m = 0
while 1:
    m += b
    if temp >= h:
        dp[h] = m
        break
    else:
        dp[temp] = m
    temp += a

if n == 1:
    print(dp[h])
    exit()

for c, a, b in abc[1:]:
    if a < h:
        if dp[a] == 0:
            dp[a] = b
        else:
            dp[a] = min(dp[a], b)
    for i in range(1, h):
        if dp[i] != 0:
            if i + a >= h:
                dp[h] = min(dp[h], dp[i] + b)
            elif dp[i+a] == 0:
                dp[i+a] = dp[i] + b
            else:
                dp[i+a] = min(dp[i+a], dp[i] + b)

print(dp[h])

Measured memory_bytes: 42220
#include <bits/stdc++.h>
using namespace std;
int main() {
    int k;
    string str;
    while (cin >> k) {
        cin >> str;
        if (str.size() <= k)
            cout << str << '\n';
        else
            cout << str.substr(0, k) << "...\n";
    }
    return 0;
}

Measured memory_bytes: 3628
# coding:utf-8
array = map(int, raw_input().split())
n = array[0]
m = array[1]
a = [[0 for i in range(m)] for j in range(n)]
b = [0 for i in range(m)]
answer = [0 for i in range(n)]
for i in range(n):
    a[i] = map(int, raw_input().split())
for j in range(m):
    b[j] = input()
for i in range(n):
    for j in range(m):
        answer[i] += a[i][j] * b[j]
for i in range(n):
    print answer[i]



Measured memory_bytes: 4900
s = input()
res = 0

for mask in range(1 << len(s) - 1):
    cur = 0
    for i in range(len(s)):
        cur *= 10
        cur += int(s[i])
        if mask & (1 << i):
            res += cur
            cur = 0
    res += cur

print(res)

Measured memory_bytes: 3064
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let s = get!(String).chars().map(|e| e == '1').collect::<Vec<_>>();
    let n = s.len();
    if !s[0] || s[n-1] {
        println!("-1");
        return;
    }
    for i in 0..n-1 {
        if s[i] != s[n-i-2] {
            println!("-1");
            return;
        }
    }
    let mut mn = n-1;
    let mut edges = Vec::new();
    for i in (0..n-1).rev() {
        edges.push((i,mn));
        if s[i] {
            mn = i;
        }
    }
    for (l,r) in edges {
        println!("{} {}", l+1,r+1);
    }
}


Measured memory_bytes: 11772
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const long double EPS = 1e-9;
const ll mod = 1e9 + 7;
const ll INF = 1e9;

#define rep(i, n) for(ll i = 0; i < n ; i++ )
#define For(i, a, b) for(ll i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

const ll MAX_N = 100;

int main(void){
    ll A[MAX_N];
    ll N;

    cin >> N;
    rep(i, N) cin >> A[i];
    sort(A,A+N);
    cout << A[N-1] - A[0] << endl;
    return 0;
}


Measured memory_bytes: 256