akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
ll M=1e9 + 7;

ll power(ll x, ll y)
{
    ll res=1;
    x=x%M;
    while(y>0)
    {
        if( y&1 )
        {
            res = (res*x)%M;
        }
        y = y >> 1;
        x = (x*x)%M;
    }
    return res%M;
}

ll C(ll n, ll r)
{
    ll j1=1;
    //r=min(r,n-r);
    for(ll i=n;i>n-r;i--)
    {
        j1 = (j1*i)%M;
    }
    ll j2=1;
    for(ll i=1;i<=r;i++) j2 = (j2*i)%M;
    j2=power(j2,M-2);
    j1 = (j1*j2)%M;
    return j1;
    
    
}



int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	ll n,a,b; cin>>n>>a>>b;
	ll ans=power(2,n);
	ans+=1e9+6;
	//cout<<C(n,a)<<endl;
	ans -= C(n,a);
	ans += 1e9 + 7;
	ans -= C(n,b);
	ans%=M;
	cout<<ans;
	
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main() {
    int A, B, C, tmp, x, y, c;
    VI a, b;

    cin >> A >> B >> C;
    REP(i, A) {
        cin >> tmp;
        a.PB(tmp);
    }

    REP(i, B) {
        cin >> tmp;
        b.PB(tmp);
    }

    int ans = INF;
    REP(i, C) {
        cin >> x >> y >> c;
        ans = min(ans, a[x-1] + b[y-1] - c);
    }

    sort(ALL(a));
    sort(ALL(b));
    cout << min(a[0]+b[0], ans) << endl;
}

Measured memory_bytes: 1528
//#include <GOD>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define len length	
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define freo freopen("output.txt","w",stdout)
#define frei freopen("input.txt","r",stdin)

const ll inf=1e18;
const ll mod=1e9+7;
const ll maxn=5e3+10,maxp=10110;

ll n,ans;
vector <ll> ve1,ve2,ve3,ve4;

int main(){
	FAST_IO;
	cin>>n;
	for(int i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		ve1.pb(x+y);
		ve2.pb(x-y);
	//	ve3.pb(y-x);
	//	ve4.pb(-x-y);
	}
	sort(ve1.begin(),ve1.end());
	sort(ve2.begin(),ve2.end());
//	sort(ve3.begin(),ve3.end());
//	sort(ve4.begin(),ve4.end());
	ans=ve1[n-1]-ve1[0];
	ans=max(ans,ve2[n-1]-ve2[0]);
//	ans=max(ans,ve3[n-1]-ve3[0]);
//	ans=max(ans,ve4[n-1]-ve4[0]);
	cout<<ans<<endl;
}


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

using namespace std;

int N, dp[200005];
int nex[200005][26];
int rev[200005];
int str[200005];
int last[26];
string s;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> s;
	N = s.size();
	for (int i = 1; i <= N; ++i){
		str[i] = s[i-1] - 'a';
	}
	for (int i = 0; i < 26; ++i){
		last[i] = N+1;
		dp[N+1] = 0;
	}

	for (int i = N; i >= 0; --i){
		dp[i] = 1e9;
		for (int j = 0; j < 26; ++j){
			nex[i][j] = last[j];
			last[j] = (str[i] == j ? i : last[j]);
			if (dp[nex[i][j]] + 1 < dp[i]){
				rev[i] = j;
				dp[i] = dp[nex[i][j]] + 1;
			}
		}
	}
	s.clear();
	int cur = 0;
	while (cur != N+1){
		s.push_back((char) ('a' + rev[cur]));
		cur = nex[cur][rev[cur]];
	}
	cout << s << '\n';
}

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

 int main() {
   string s;
   cin >> s;
   int n =s.length();
   bool a = true;
   if (s[0] != 'A') {
     a = false;
   }

   if (a) {
     int count = 0;
     int c;
     for (size_t i = 2; i < n-1; i++) {
       if (s[i] == 'C') {
         count++;
         c = i;
       }
     }
     if (count != 1) a = false;

     for (int i = 1; i < n; i++) {
       if (i != c && (s[i] < 'a' || s[i] > 'z')) {
         a = false;
         break;
       }
     }

   }
   if (a) {
     cout << "AC" << '\n';
   }else{
     cout << "WA" << '\n';
   }
 }


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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

inline void Main() {
  // code
  int a, b;
  cin >> a >> b;
  cout << max(a+b,max(a-b,a*b)) << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
/**
*    author:  velengel
*    created: 08.05.2020 19:50:45
*    to run & test the code, type below command.
*    cptest abc000_a
**/

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll x;
  cin >> x;
  ll tkhs = 100;
  int ans = 0;
  while (tkhs < x)
  {
    ans++;
    tkhs *= 1.01;
  }
  cout << ans << endl;
  return 0;
}

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

#[allow(unused_macros)]
macro_rules! scan {
  ($e:expr; $t:ty) => {
    $e.get::<$t>()
  };
  ($e:expr; $($t:ty), *) => {
    ($($e.get::<$t>(),)*)
  }
}

struct Scanner<R: BufRead> {
  reader: R,
  iter: std::vec::IntoIter<String>
}

#[allow(dead_code)]
impl<R: BufRead> Scanner<R> {
  fn new(reader: R) -> Scanner<R> {
    Scanner { reader, iter: vec![String::new()].into_iter() }
  }
  fn new_line(&mut self) {
    let mut line = String::new();
    self.reader.read_line(&mut line).ok();
    self.iter = line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>().into_iter();
  }
  fn get<T: FromStr>(&mut self) -> T {
    self.iter.next().unwrap().parse().ok().unwrap()
  }
  fn get_line(&mut self) -> String {
    self.iter.clone().collect::<Vec<String>>().join(" ")
  }
}

fn main() {
  let cin = stdin();
  let cin = cin.lock();
  let mut scanner = Scanner::new(cin);
  let mut arr = [0; 26];
  loop {
    scanner.new_line();
    let s = scanner.get_line();
    if s == "" {
      break;
    }
    let s: String = s.chars().map(|c| {
      if c.is_uppercase() {
        c.to_lowercase().to_string()
      }
      else {
        c.to_string()
      }
    })
    .collect();
    for c in s.chars() {
      if c.is_alphabetic() {
        let idx = ((c as u8) - ('a' as u8)) as usize;
        arr[idx] += 1;
      }
    }
  }
  for i in 0..26 {
    println!("{} : {}", (('a' as u8) + i) as char, arr[i as usize]);
  }
}



Measured memory_bytes: 5060
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
  public static void Main()
  {
    var n = int.Parse(Console.ReadLine());
    var xs = new long[n];
    for (int i = 0; i < xs.Length; i++)
    {
      xs[i] = int.Parse(Console.ReadLine());
    }

    Array.Sort(xs);
    var ys = new LinkedList<long>(xs);
    var k = new long[2];
    for (int sym = 0; sym < k.Length; sym++)
    {
      var first = ys.First.Value;
      var last = first;
      var firstIsFirst = true;
      ys.RemoveFirst();
      for (int i = 0; ys.Any(); i++)
      {
        var y = i % 2 == 0 ? ys.Last : ys.First;
        ys.Remove(y);
        var f = Math.Abs(first - y.Value);
        var l = Math.Abs(last - y.Value);
        if (f > l && (i % 2 == 0 || !firstIsFirst || !ys.Any()))
        {
          k[sym] += f;
          first = y.Value;
          firstIsFirst = i % 2 != 0;
        }
        else
        {
          k[sym] += l;
          last = y.Value;
        }
      }
      ys = new LinkedList<long>(xs.Reverse());
    }
    Console.WriteLine(k.Max());
  }

  static long Naive(int i, long[] xs)
  {
    if (i >= xs.Length - 1)
    {
      return xs.Skip(1).Zip(xs, (x, y) => Math.Abs(x - y)).Sum();
    }

    var k = 0L;
    for (int j = i; j < xs.Length; j++)
    {
      var t = xs[j];
      xs[j] = xs[i];
      xs[i] = t;
      k = Math.Max(k, Naive(i + 1, xs));
      t = xs[j];
      xs[j] = xs[i];
      xs[i] = t;
    }
    return k;
  }
}

Measured memory_bytes: 32968
n = int(input())
d = {}
for ai in input().split():
  ai = int(ai)
  if ai not in d:
    d[ai] = 0
  d[ai] += 1

n2 = [k for k in d if d[k] > 1]
n4 = [k for k in d if d[k] > 3]

n2.sort(reverse = True)
n4.sort(reverse = True)

ans = 0

if n4:
  ans = n4[0] ** 2

if len(n2) > 1:
  ans = max(ans, n2[0] * n2[1])

print(ans)


Measured memory_bytes: 23848
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
for i in range(2):
  if s[i] != s[i+1]:
    count += 1
print("Yes" if count >= 1 else "No")

Measured memory_bytes: 38256
import java.util.*;
import java.lang.Double;

public class Main {

    public static void main(String[] args) {
      Scanner reader=new Scanner(System.in);
       long x=reader.nextLong();
       long yokin=100;
       int year=0;
      while(yokin<x)
      {
        year++;

        yokin=(long)(yokin+(long)yokin*0.01);

      }
      System.out.println(year);
}




}


Measured memory_bytes: 35756
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;++i)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(15);
  int N;cin >> N;
  vector<ll> v(N);
  REP(i,N) cin >> v[i];
  sort(v.begin(),v.end(),greater<ll>());
  queue<PLL> ans;
  ll maximum = v[0], minimum = v[N-1];
  REP(i,N-2){
    if(v[i+1]>=0){
      ans.push(PLL(minimum,v[i+1]));
      minimum-=v[i+1];
    }else{
      ans.push(PLL(maximum,v[i+1]));
      maximum-=v[i+1];
    }
  }
  ans.push(PLL(maximum,minimum));
  cout << maximum-minimum << endl;
  while(!ans.empty()){
    cout << ans.front().first << " " << ans.front().second << endl;
    ans.pop();
  }
  return 0;
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}

int main()
{
    int n = 0;
    //printf("Hello World");
    scanf("%d", &n);
    call(n);
    return 0;
}


Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,c0=0,c1=0,c2=0,c3=0;
  cin>>n;
  string s;
  while(n--)
  {
  cin>>s;
  if(s=="AC")
  c0++;
  else if(s=="WA")
  c1++;
  else if(s=="TLE")
  c2++;
  else
  c3++;
  }
  cout<<"AC x "<<c0<<"\nWA x "<<c1<<"\nTLE x "<<c2<<"\nRE x "<<c3<<"\n";

}

Measured memory_bytes: 3604
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	s := fmt.Sprintf("%b", n)
	ans := 0.0
	for i := 0; i < len(s); i++ {
		ans += math.Pow(2, float64(i))
	}
	fmt.Println(int(ans))
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<string.h>
#define ll long long int
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MAX_LIMIT 100000
#define r return 0
#define f(i,a,n) for(i=a;i<n;++i)
using namespace std;
int main()
{
    fio
    string s,a,b,c,d;
    cin>>s;
    a=s[0];
    b=s[1];
    c=s[2];
    d=s[3];
    stringstream geek(a);
    stringstream geeks(b);
    stringstream geekss(c);
    stringstream geeksss(d);
    int x=0,y=0,z=0,t=0;
    geek>>x;
    geeks>>y;
    geekss>>z;
    geeksss>>t;
    if(x*10+y<=12 && z*10+t<=12 && x*10+y!=0 && z*10+t!=0){
        cout<<"AMBIGUOUS"<<endl;
    }
    else{
    if(x*10+y<=12 && x*10+y!=0){
        cout<<"MMYY"<<endl;
    }
    else if(z*10+t<=12 && z*10+t!=0 ){
        cout<<"YYMM"<<endl;
    }
    else{
        cout<<"NA"<<endl;
    }
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		long d = sc.nextLong();
		long ans = a * c;
		
		if(a * c < a * d) {
			ans = a * d;
		}
		if(ans < b * c) {
			ans = b * c;
		}
		if(ans < b * d) {
			ans = b * d;
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 27080
def get_H(cx,cy):
  for info in info_list:
    if info[2] != 0:
      H0 = info[2] + abs(info[0]-cx) + abs(info[1]-cy)
      break

  for info in info_list:
    if info[2] != max(H0 - abs(info[0]-cx) - abs(info[1]-cy),0): return -1  
  return H0

N = int(input())
info_list = []
for _ in range(N):
  x,y,h = map(int,input().split())
  info_list.append([x,y,h])

for cx in range(101):
  for cy in range(101):
    res = get_H(cx,cy)
    if res != -1:
      print(cx,cy,res)

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

using namespace std;
int main(){
    long X;
  cin >> X;
  int year = 0;
  long cur = 100;
  if (1582054107 < X){
    year = 1723;
    cur = 1582054107;
  }
  //X=100000000000000000;
  while(cur < X){
    year++;
    cur += cur/100;
  }
  cout << year<<endl;
  
  
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

int main(){
	int A, B;
	cin >> A >> B;

	int ans = B / 100 - A / 100;
	int Atop = (A / 10000 + A / 1000 * 10) % 100;
	int Btop = (B / 10000 + B / 1000 * 10) % 100;
	if (Atop >= A % 100) ans++;//上二桁 下二桁
	if (Btop > B % 100) ans--;//上二桁 下二桁

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const int N = 3e3 + 1;
ll dp[N][N][5]; 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n, m, k;
        cin >> n >> m >> k;
        vector<vector<ll>> v(n, vector<ll>(m));
        for(i = 0; i < k; i++){
            ll a, b, c;
            cin >> a >> b >> c;
            --a, --b;
            v[a][b] = c;
        }
        
        for(i = 0; i < n; i++){
            for(j = 0; j < m; j++){
                for(ll prev = 0; prev <= 3; prev++){
                    if(prev < 3)
                       dp[i + 1][j + 1][prev + 1] = max(dp[i + 1][j + 1][prev + 1], dp[i + 1][j][prev] + v[i][j]);
                    dp[i + 1][j + 1][1] = max(dp[i + 1][j + 1][1], dp[i][j + 1][prev] + v[i][j]);
                    dp[i + 1][j + 1][0] = max(dp[i + 1][j + 1][0], dp[i][j + 1][prev]);
                    dp[i + 1][j + 1][prev] = max(dp[i + 1][j + 1][prev], dp[i + 1][j][prev]);
                }
                
            }
        }
        cout << max({dp[n][m][1], dp[n][m][2], dp[n][m][3], dp[n][m][0]});
    }
    return 0;
}

Measured memory_bytes: 425396
use std::io::*;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let size = iter.next().unwrap().parse().unwrap();

    let mut vec = Vec::with_capacity(size);
    for _i in 0..size {
        let i: u64 = iter.next().unwrap().parse().unwrap();
        vec.push(i);
    }


    let mut count = 0 as u64;
    for i in 0..size {
        let mut v = vec[i];
        loop {
            if v == 0 {
                break;
            }

            let modulable = v % 2 == 0;
            if modulable {
                count += 1;
            } else {
                break;
            }
            v /= 2;
        }
    }
    println!("{}", count);
}


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

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

    int a[n];
    int b[100001]={0};
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        b[a[i]]++;
    }
    for(int i=0;i<100;i++)
    {
       if(b[find-i]==0) 
        {
         cout<<find-i<<endl; 
       	 break;
       	}
       if(b[find+i]==0)
       {
        cout<<find+i<<endl;
        break;
       }

    }
    return 0;
    }


Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,W;
  cin >> H >> W;
  
  vector<vector<char>> a(H,vector<char>(W));
  for(int i=0; i<H; i++){
   for(int j=0; j<W; j++){
     cin >> a[i][j];
   }
  }
  
  int count=0;
  
  for(int i=0; i<H; i++){
    int row=0;
   for(int j=0; j<W; j++){
     if(a[i][j]=='.') row++;
   }
   if(row==W){
     count++;
    for(int j=0; j<W; j++){
     a[i][j]=0; 
    }
   }
  }
  
  for(int j=0; j<W; j++){
    int ver=0;
   for(int i=0; i<H; i++){
     if(a[i][j]=='.') ver++;
   }
   if(ver==H-count){
    for(int i=0; i<H; i++){
     a[i][j]=0; 
    }
   }
  }
  
  bool dele=false;
  
  for(int i=0; i<H; i++){
   for(int j=0; j<W; j++){
     if(a[i][j]=='.' || a[i][j]=='#'){
      cout << a[i][j];
       dele = true;
     }
   }
    if(dele==true) cout << endl;
  }
  
  
  
}

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

using namespace std;
const int N = 1005, MOD = 1e9 + 7;
int a[N], b[N], cnt[N*N], cnt1[N*N], cnt2[N*N], mark[N*N];

int main()
{
    int n, m; cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i], a[i]--, cnt1[a[i]]++;
    for (int i = 0; i < m; i++) cin >> b[i], b[i]--, cnt2[b[i]]++;
    for (int i = 0; i < n * m; i++) {
        if (max(cnt1[i], cnt2[i]) > 1) return cout << 0, 0;
    }
    if (min(cnt1[n * m - 1], cnt2[n * m - 1]) < 1) return cout << 0, 0;
    for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cnt[min(a[i], b[j])]++;
    int CNT = 0, ans = 1;
    for (int i = n * m - 1; i >= 0; i--) {
        CNT += cnt[i];
        if (cnt1[i] == 0 && cnt2[i] == 0) ans = (1ll * ans * CNT) % MOD;
        else if (min(cnt1[i], cnt2[i]) == 0) ans = (1ll * ans * cnt[i]) % MOD;
        CNT--;
    }
    cout << ans << "\n";
}


Measured memory_bytes: 6400
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main
{

	public static void main(String[] args)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		??????A????????°??¨?????°?????????
		String[] strs = br.readLine().split(" ");
		int n = Integer.parseInt(strs[0]);
		int m = Integer.parseInt(strs[1]);
//		??\??????????????°??????????????????A??¨B?????????
		int[][] a = new int[n][m];
		int[] b = new int[m];
		
		String[] buf = new String[m];
//		??????A
		for(int row=0; row<n; row++)
		{
			buf = br.readLine().split(" ");
			for(int col=0; col<m; col++)
			{
				a[row][col] = Integer.parseInt(buf[col]);
			}
		}
//		?¬????B
		for(int col=0; col<m; col++)	b[col] = Integer.parseInt(br.readLine());
//		A*B????????????C???????´?
		int[] c = new int[n];
		for(int row=0; row<n; row++)
		{
			for(int col=0; col<m; col++)
			{
				c[row] += a[row][col] * b[col];
			}
		}
//		C?????????????????????
		for(int row=0; row<n; row++)
		{
			System.out.println(c[row]);
		}
	}
}

Measured memory_bytes: 27692
#include<iostream>
#include<string>

using namespace std;


void hello_world(){
  cout << "Hello World" << endl;
}


void add(int a, int b){
  int c;
  c = a + b;
  cout << c << endl;
}

int main(){
  int n;
  cin >> n;
  if (n==1){
    hello_world();
  }
  else {
    int a,b;
    cin >> a;
    cin >> b;
    add(a,b);
  }
  return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
s = list(map(int, input().split()))
c = 0
a = 'a'
def merge(A, left, mid, right):
    global c
    L = A[left:mid]
    R = A[mid:right]
    L.append(sys.maxsize)
    R.append(sys.maxsize)
    i = 0
    j = 0
    for k in range(left, right):
        c += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def mergesort(A, left, right):
    if left+1 < right:
        mid = (left+right)//2
        mergesort(A, left, mid)
        mergesort(A, mid, right)
        merge(A, left, mid, right)

mergesort(s, 0, n)

for i in range(n-1):
    print(s[i], end=' ')
print(s[n-1])
print(c)


Measured memory_bytes: 61660
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <numeric>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
typedef pair<string, int> P;
#define mod 1e9 + 7;
ll gcd(ll x, ll y)
{
	ll r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}
ll lcm(ll x, ll y)
{
	x /= gcd(x, y);
	y /= gcd(x, y);
	return (x * y);
}

string in;
int tot[55][55];

int main()
{
	ios_base::sync_with_stdio(false);
	ll n;
	while (cin >> n) {
		vll v;
		v.pb(0);
		v.pb(0);
		map<ll, ll> mp;
		rep(i, n) {
			ll x;
			cin >> x;
			mp[x]++;
			if (mp[x] == 2) {
				v.pb(x);
				mp[x] -= 2;
			}
		}
		/*rep(i, v.size()) {
			cout << v[i] << endl;
		}*/
		sort(reall(v));
		cout << v[0] * v[1] << endl;
	}
	return 0;
}

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

int main() {
  int S, h, m, s, lest_second=0;
  
  cin >> S;
  
  h = S / (60*60);
  
  lest_second = S - (60*60)*h;
  
  m = lest_second / 60;
  
  lest_second -= 60*m;
  
  cout << h << ":" << m << ":" << lest_second << endl;
}



Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> A(n-1);
	vector<int> B(n);
	for(int i=0;i<n-1;i++){
		cin >> A.at(i);
		B.at(A.at(i)-1)++;
	}

	B.at(n-1) = 0;

	for(int i=0;i<n;i++){
		cout << B.at(i) << endl;
	}

}	


Measured memory_bytes: 6364
#include<stdio.h>
int main()
{
	int A,B,C;
	scanf("%d %d %d",&A,&B,&C);
	int temp,temp1;
	temp=A;
	A=B;
	B=temp;
	temp1=A;
	A=C;
	C=temp1;
	printf("%d %d %d\n",A,B,C);
	return 0;
}

Measured memory_bytes: 128
program test
implicit none
integer(8) :: n,i,j,k
integer(8) :: dp(0:12,0:100000)
integer(8),parameter :: ten = 10
integer(8) :: inf = ten ** 15
integer(8) :: money(12) = (/1,6**1,6**2,6**3,6**4,6**5,6**6,9**1,9**2,9**3,9**4,9**5/)

read(*,*) n

dp(0:12,0) = 0
dp(0:12,1:100000) = inf

do i = 1,12
	do j = 1,n
		k = 1
		dp(i,j) = dp(i-1,j)
		do while (j >= money(i)*k .and. k<= 8)
			dp(i,j) = min(dp( i-1,j-(k*money(i)))+k,dp(i-1,j),dp(i,j))
			k = k + 1
		enddo
	enddo
enddo

write(*,*) dp(12,n)

end program

Measured memory_bytes: 10368
import sys
import math

sys.setrecursionlimit(10**5)

def is_prime_num(num):
    for i in range(2, int(math.sqrt(num))):
        if num % i == 0:
            return False
    return True

x = int(input())
target = x
do = True
while do:
    if is_prime_num(target):
        print(target)
        do = False
    target += 1


Measured memory_bytes: 3060
class Factorial:
    def __init__(self,n,mod):
        self.f=[1]
        self.mod=mod
        for i in range(1,n+1):
            self.f.append(self.f[-1]*i%mod)
        self.i=[pow(self.f[-1],mod-2,mod)]
        for i in range(1,n+1)[::-1]:
            self.i.append(self.i[-1]*i%mod)
        self.i.reverse()
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.i[i]
    def comb(self,n,k):
        return self.f[n]*self.i[n-k]%self.mod*self.i[k]%self.mod if n>=k else 0
M=10**9+7
a,b,c,d=map(int,input().split())
comb=Factorial(c+d+2,M).comb
f=lambda r,c:comb(c+r+2,r+1)-c-r-2
print((f(c,d)-f(c,b-1)-f(a-1,d)+f(a-1,b-1))%M)

Measured memory_bytes: 161452
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    vector<double> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    double ans = A[0];
    for(int i=1; i<N; i++){
        ans = (ans+A[i])/2;
    }
    cout << ans << endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (int i=0;i<N;i++)
#define loop(i,N,M) for(int i=N;i<M;i++)

//変数
ll N, M;
//解法
void solve() {

	if (N == 1) {
		cout << M;
		return;
	}

	vector<ll> GCF;

	ll cnt = (ll)sqrt(M)+1;
	loop(i, 1, cnt) {
		if (M%i == 0) {
			GCF.emplace_back(i);
			GCF.emplace_back(M / i);
		}
	}

	sort(GCF.begin(), GCF.end(),greater<ll>());

	rep(i, GCF.size()) {
		if (M/GCF[i] >= N) {
			cout << GCF[i];
			break;
		}
	}

	return;
}

int main() {
	//入力
	cin >> N >> M;
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
s = list(input())
ans = 0
if s[0] == "0":
    for i in range(1,len(s)):
        if s[i] == s[i-1] and s[i] == "0":
            s[i] = "1"
            ans += 1
        elif s[i] == s[i-1] and s[i] == "1":
            s[i] = "0"
            ans += 1
elif s[0] == "1":
    for i in range(1,len(s)):
        if s[i] == s[i-1] and s[i] == "0":
            s[i] = "1"
            ans += 1
        elif s[i] == s[i-1] and s[i] == "1":
            s[i] = "0"
            ans += 1
print(ans)

Measured memory_bytes: 3956
K = int(input())
A = list(map(int, input().split()))
ma = 2
mi = 2
for a in reversed(A):
    ma = a * (ma // a + 1) - 1
    mi = a * -(-mi // a)
    if mi > ma:
        print(-1)
        break
else:
    print(mi, ma)

Measured memory_bytes: 14224
#include<stdio.h>

int main(void){
  double x[12];
  char u[5];
  int count=0,n=0;
  double sum=0;
  
  scanf("%d",&n);
  while(count<n){
    scanf("%lf",&x[count]);
    scanf("%s",u);
    if(u[0]=='B'){
       sum=sum+x[count]*380000.0;
    }else{
   
     sum=sum+x[count];
    }
   count++;
  }
  
  

  printf("%f\n",sum);
  return 0;
}

Measured memory_bytes: 128
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]
    def find(self, x):
        """
        x が属するグループを探索して親を出す。
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]
    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)
    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]


N,Q = map(int,input().split())
uf = UnionFind(N)
for _ in range(Q):
  t,u,v =  map(int,input().split())
  if t == 0:
    uf.union(u,v)
  else:
    if uf.is_same(u,v):
      print(1)
    else:
      print(0)


Measured memory_bytes: 19308
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;
int n,m,p;
vector< vector<pi> >adj;
vector<int>dis,vis,ok;
void dfs(int u)
{
    if(vis[u])return;
    vis[u]=1;
    for(auto tmp:adj[u])
    {
        int v=tmp.fi;
        if(vis[v])continue;
        dfs(v);
    }
}
 main()

{
    fast
    cin>>n>>m>>p;
    adj.resize(n);
    f(i,0,m-1)
    {
        int u,v,w;
        cin>>u>>v>>w;
        u--;v--;
        adj[u].pb(mp(v,p-w));
    }
    ok.resize(n,0);
    vis.resize(n,0);
    f(i,0,n-1)
    {
        vis.assign(n,0);
        dfs(i);
        if(vis[n-1])ok[i]=1;
        else ok[i]=0;
    }
    dis.resize(n,inf);
    dis[0]=0;
    f(i,0,n-1)
    {
        f(u,0,n-1)
        {
            for(auto tmp:adj[u])
            {
                int v=tmp.fi;
                int c=tmp.si;
                if(ok[v]==0)continue;
                if(dis[u]<inf && dis[u]+c<dis[v])
                {
                    dis[v]=dis[u]+c;
                    if(i==n-1)
                    {
                        cout<<"-1"<<endl;
                        return 0;
                    }
                }
            }
        }
    }
    int ses=-dis[n-1];
    ses=max(ses,0LL);
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 3912
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')
YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(X: int):
    return [NO, YES][X >= 30]


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    print(f'{solve(X)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 75144
from itertools import product

n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]

ans = float("inf")
for pat in product([0, 1], repeat=n):
    sm = [0] * m
    cost = 0
    for i, bl in enumerate(pat):
        if bl:
            cost += ca[i][0]
            for j, e in enumerate(ca[i][1:]):
                sm[j] += e

    ok = True
    for e in sm:
        if e < x:
            ok = False

    if ok:
        ans = min(ans, cost)

if ans == float("inf"):
    ans = -1

print(ans)


Measured memory_bytes: 9220
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }
#define chmax(a,b) a = max(a,b)

ll R, C, k, r, c, v, a[3005][3005] = {}, dp[3005][3005][4] = {}, ans = 0;

int main() {
	cin >> R >> C >> k;
	rep(i, k) {
		cin >> r >> c >> v;
		a[r - 1][c - 1] = v;
	}
	rep(i, R) {
		rep(j, C) {
			for (int l = 3; l > 0; l--) {
				chmax(dp[i][j][l], dp[i][j][l - 1] + a[i][j]);
				chmax(dp[i + 1][j][0], dp[i][j][l]);
				chmax(dp[i][j + 1][l], dp[i][j][l]);
			}
		}
	}
	rep(i, 4)chmax(ans, dp[R - 1][C - 1][i]);
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {

	


	int a[3];
	int count = 0;

	for(int i = 0; i < 3; i++) {
		scanf("%d", &a[i]);
	}

	sort(a, a+3);


	if((a[1] - a[0]) % 2 == 1) {
		a[1] = a[1] + 1;
		a[2] = a[2] + 1;
		
		count++;
		count += (a[1] - a[0]) / 2;
		count += (a[2] - a[1]);
	} else {
		count += (a[1] - a[0]) / 2;
		count += (a[2] - a[1]);
	}

	printf("%d\n", count);

	return 0;
}

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

int main(){

	const int N_MAX=1000000;
	int i,j,n[32],ni,soi,max;
	int so[N_MAX],count[N_MAX];
	
	for(i=0;i<N_MAX;i++)
		so[i]=1;
	ni=0;
	max=0;
	while(cin>>n[ni])
		if(n[ni++]>max)
			max=n[ni-1];
	so[0]=so[1]=0;
	for(soi=0,i=2;i<=1000;i++){
		if(so[i]==0)continue;
		for(j=i*2;j<=max;j+=i)
			so[j]=0;
	}
	for(i=2;i<=max;i++){
		count[i] = count[i-1]+so[i];
	}
	for(i=0;i<ni;i++)
		cout << count[n[i]] << endl;

	return 0;
}

Measured memory_bytes: 8972
#[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();
    }
}

const MOD: usize = 1_000_000_007;

fn solve() {
    let s = get!(String).chars().collect::<Vec<_>>();

    let n = s.len();
    let mut dp = vec![vec![0usize; 13]; n+1];
    dp[0][0] = 1;
    for i in 0..n {
        if s[i] == '?' {
            for j in 0..13 {
                for k in 0..10 {
                    let rem = (j*10+k)%13;
                    dp[i+1][rem] += dp[i][j];
                    dp[i+1][rem] %= MOD;
                }
            }
        } else {
            let num = s[i].to_digit(10).unwrap() as usize;
            for j in 0..13 {
                let rem = (j*10+num)%13;
                dp[i+1][rem] += dp[i][j];
                dp[i+1][rem] %= MOD;
            }
        }
    }
    println!("{}", dp[n][5]);
}


Measured memory_bytes: 22908
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using vs = vector<string>;
template <typename T>
using ost = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;
#define forn(i,n) for(int i=0; i<int(n); ++i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ff first
#define ss second

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi xs(n);
    for (int& x:xs) cin >> x;
    int ans=1;
    int hi=0, lo=0, x=xs[0];
    for (int y:xs) {
        hi |= y>x;
        lo |= y<x;
        if (hi&&lo)
            ans++, hi=lo=0;
        x=y;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 640
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    long X = lread();
    if (X < 100)
    {
        writeln(0);
        return;
    }
    long M = X % 100;
    long N = X / 100;
    foreach (i; 0 .. N)
    {
        if (M <= 5)
        {
            writeln(1);
            return;
        }
        else
        {
            M -= 5;
        }
    }
    writeln(0);
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var s = consoleReader.String;
            return s[0] == s[2] ? "Yes" : "No";
        }

        #region いつもの
#pragma warning disable
        private ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
    }
    static class Ext
    {
        public static Dictionary<TKey, int> GroupCount<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => source.GroupBy(keySelector).ToDictionary(g => g.Key, g => g.Count());
        public static Dictionary<TKey, int> GroupCount<TKey>(this IEnumerable<TKey> source) => source.GroupCount(i => i);
    }
    public class ConsoleReader { private string[] ReadLineSplit() => textReader.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries); private string[] line = Array.Empty<string>(); private int linePosition; private TextReader textReader; public ConsoleReader(TextReader tr) { textReader = tr; } public int Int => int.Parse(String); public long Long => long.Parse(String); public double Double => double.Parse(String); public string String { get { if (linePosition >= line.Length) { linePosition = 0; line = ReadLineSplit(); } return line[linePosition++]; } } public class SplitLine { private string[] splited; public SplitLine(ConsoleReader cr) { splited = cr.ReadLineSplit(); cr.line = Array.Empty<string>(); } public int[] Int => String.Select(x => int.Parse(x)).ToArray(); public int[] Int0 => String.Select(x => int.Parse(x) - 1).ToArray(); public long[] Long => String.Select(x => long.Parse(x)).ToArray(); public double[] Double => String.Select(x => double.Parse(x)).ToArray(); public string[] String => splited; } public SplitLine Split => new SplitLine(this); public class RepeatReader : IEnumerable<ConsoleReader> { ConsoleReader cr; int count; public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; } public IEnumerator<ConsoleReader> GetEnumerator() => Enumerable.Repeat(cr, count).GetEnumerator(); System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public IEnumerable<string> String => this.Select(cr => cr.String); public IEnumerable<int> Int => this.Select(cr => cr.Int); public IEnumerable<int> Int0 => this.Select(cr => cr.Int - 1); public IEnumerable<long> Long => this.Select(cr => cr.Long); public IEnumerable<double> Double => this.Select(cr => cr.Double); } public RepeatReader Repeat(int count) => new RepeatReader(this, count); }
    #endregion
}


Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, k, z = 123456;
    string s[17] = {};
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++) cin >> s[i];
    for (int i = 0; i < (1 << (n - 1)); i++) {
        int a[17][1003] = {}, b[17] = {}, o = 0;
        for (int j = 0; j < n; j++) {
            b[j] = o;
            if (i & (1 << j)) o++;
        }
        int y = __builtin_popcount(i), x[17] = {};
        for (int j = 0; j < n; j++) for (int l = 0; l < m; l++) if (s[j][l] == '1') a[b[j]][l]++;
        //for (int j = 0; j < n; j++) cout << b[j] << ' '; cout << '\n';
        //for (int j = 0; j <= o; j++) {
        //    for (int l = 0; l < m; l++) cout << a[j][l] << ' '; cout << '\n';
        //} cout << '\n';
        for (int j = 0; j < m; j++) {
            for (int l = 0; l <= o; l++) {
                if (a[l][j] > k) y = 123456;
                x[l] += a[l][j];
            }
            bool w = 0;
            for (int l = 0; l <= o; l++) {
                if (x[l] > k) w = 1;
            }
            if (w) {
                y++;
                for (int l = 0; l <= o; l++) x[l] = a[l][j];
            }
        }
        z = min(z, y);
    }
    cout << z;
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
         
typedef long long ll;
using namespace std;
        
#define F first
#define S second
#define sqr(x) x*x
#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
#define repit(i, n) for(auto it = n.begin(); it != n.end(); ++it)
       
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
int lcm(int a,int b){return abs(a*b)/gcd(a,b);}
     
int main(){ios_base::sync_with_stdio(0);cin.tie(0);
    int n , m;
    vector <int> v;
    cin >> n;
    for(int i = 0 ; i < n; ++i){
        int x;
        cin >> x;
        v.pb(x);
    }

    cin >> m;
    int arr[m][2];
    for(int i = 0; i < m; ++i){
        for(int j = 0; j < 2; j++){
            cin >> arr[i][j];
        }
    }
    
    int sum = 0; 
    for(int  i = 0; i < sz(v); ++i){
        sum += v[i]; 
    }
    for(int i = 0; i < m; ++i){
        int pre = v[arr[i][0] - 1];
        cout << sum - pre + arr[i][1] << "\n";
    }
    
}

Measured memory_bytes: 256
lis = list(map(int,input().split()))
lis.sort()
if lis[0] == lis[1]:
  if lis[1] != lis[2]:
    print("Yes")
    exit()
if lis[1] == lis[2]:
  if lis[0] != lis[1]:
    print("Yes")
    exit()
print("No")

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  while (true) {
    if (a.size() == 1) {
      cout << a[0] << endl;
      break;
    }
    a[a.size() - 1] %= a[0];
    if (a[a.size() - 1] <= 0) {
      a.pop_back();
      continue;
    }
    sort(a.begin(), a.end());
  }
  return 0;
}


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

using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<long> as(N);
	for (int i = 0; i < N; i++) cin >> as[i];
	long ans = 0, r = 0, x = 0, s = 0;
	for (int l = 0; l < N; l++)
	{
		while(x == s && r < N)
		{
			r++;
			x ^= as[r-1];
			s += as[r-1];
		}
		ans += r-l-(x!=s);
		x ^= as[l];
		s -= as[l];
	}
	cout << ans << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	int count[31] = { 0 };
	int K;
	int a;
	for (int i = 0; i < N; i++) {
		cin >> K;
		for (int t = 0; t < K; t++) {
			cin >> a;
			count[a]++;
		}
	}
	int answer = 0;
	for (int v = 0; v <= M; v++) {
		if (count[v] == N) {
			answer++;
		}
	}
	cout << answer;
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

    class Program
    {
        
        static void Main(string[] args)
        {
            while (true)
            {
                string str = Console.ReadLine();

                if(str == "EOF" || String.IsNullOrEmpty(str))
                {
                    break;
                }

                int joi = 0;
                int ioi = 0;

                for (int i = 0; i < str.Length - 2; i++)
                {

                    if (str[i] == 'J')
                    {
                        if (str[i + 1] == 'O' && str[i + 2] == 'I')
                        {
                            joi++;
                        }
                    }
                    else if (str[i] == 'I')
                    {
                        if (str[i + 1] == 'O' && str[i + 2] == 'I')
                        {
                            ioi++;
                        }
                    }

                }

                Console.WriteLine(joi);
                Console.WriteLine(ioi);

            }
          
            
        }
    }
}



Measured memory_bytes: 15788