akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
     
     
typedef long long ll;
typedef vector <int> vi;
typedef pair <int,int> pi;
typedef tuple <int,int,int> ti;

#define forn(i,a,n) for(int i = a; i < n ; i++)
#define mem(str,a) memset(str, a, sizeof(str));
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(nullptr)
const int MOD = 1e9+7, N = 1e7 + 10, E = 1e-9;
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
//vector <int> show;
//for (auto x : show)
//   cout << x << " ";
getline(cin,s);


*/

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if(b-a == c-b)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

llong memo[100];

llong solve(int x){
  if(x == 0) return 2;
  if(x == 1) return 1;
  if(memo[x] != 0) return memo[x];

  memo[x] = solve(x - 1) + solve(x - 2);

  return memo[x];
}

int main(){

  long long n;
  scanf("%lld", &n);

  printf("%lld\n", solve(n));
  return 0;
}



Measured memory_bytes: 256
from sys import stdin

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def count_div(a, b, div):
    ac = a // div
    if ac * div < a:
        ac += 1
    bc = b // div
    if bc * div > b:
        bc -= 1
    return bc - ac + 1

if __name__ == '__main__':
    A, B, C, D = [int(x) for x in stdin.readline().rstrip().split()]

    nc = count_div(A, B, C)
    
    nd = count_div(A, B, D)
    
    CD = int(C * D / gcd(C, D))
    ncd = count_div(A, B, CD)
    
    n = B - A + 1
    
    ans = n - (nc + nd - ncd)
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

ll d[1001]={};

int main() {
	int n;
	ll a,b;
	cin>>n;
	if(n<1200){
		cout<<"ABC"<<endl;
	}else{
		cout<<"ARC"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;


int main()
{
    int n;
    scanf("%d",&n);
    int d[n][2];
    int h[n];
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&d[i][0],&d[i][1]);
        if(d[i][0]==d[i][1])
        {
            h[i]=1;
        }
        else
        {
            h[i]=0;
        }
    }
    
    int maxs=0;
    int str=0;

    for(int i=0;i<n;i++)
    {
        if(h[i]==1)
        {
            str=str+1;
            maxs=fmax(maxs,str);
        }
        else
        {
            str=0;
        }
        
    }

    
    if(maxs>2)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    

    return 0;
}

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

int h,w,vis[105][105];
char mp[105][105];

void dfs(int x,int y){
	bool bj=0;
	for (int i=1;i<=h;i++) if (mp[i][y]!='.') {bj=1;break;}
	if (!bj)
	for (int i=1;i<=h;i++) vis[i][y]=1;
	bj=0;
	for (int i=1;i<=w;i++) if (mp[x][i]!='.') {bj=1;break;}
	if (!bj)
	for (int i=1;i<=w;i++) vis[x][i]=1;
	return;
}

int main(){
	cin>>h>>w;
	getchar();
	for (int i=1;i<=h;i++){
		for (int j=1;j<=w;j++) mp[i][j]=getchar();
		getchar();
	}
	for (int i=1;i<=h;i++)
	for (int j=1;j<=w;j++)
	if ((!vis[i][j])&&(mp[i][j]=='.')) dfs(i,j);
	for (int i=1;i<=h;i++){
		bool bj=0;
		for (int j=1;j<=w;j++)
		if (!vis[i][j]) printf("%c",mp[i][j]),bj=1;
		if (bj) printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
def make753(s):
    count = 0
    if int(s) > n:
        return 0
    if all(s.count(i) > 0 for i in ['7', '5', '3']):
        count += 1
    for i in ['7', '5', '3']:
        count += make753(s + i)
    return count

n = int(input())

print(make753('0'))

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define ll long long int
#define ld long double
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr)

using namespace std;
typedef pair<int, int> pii;

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

    int sum = 0;
    for (int i = 0; i < s.length(); i++) {
        sum += s[i] - '0';
    }
    if (sum % 9 == 0) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 3764
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;

int main(void)
{
	int n;
	cin >> n;
	if (n < 1200)
	{
		cout << "ABC" << endl;
	}
	else
	{
		cout << "ARC" << endl;
	}
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;

#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))

int main()
{
    int k, n;
    cin >> k >> n;

    vi v(n);

    for(auto &e : v)cin >> e;

    int resenje = INT_MAX;

    for(int i = 0; i < n; ++i)
    {
        int predjeniPut;

        if(i == 0)
        {
            predjeniPut = k-(k - v[n-1] + v[0]);
        }
        else
        {
            predjeniPut = k-(v[i]-v[i-1]);
        }

        resenje = min(resenje, predjeniPut);
    }

    cout << resenje << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <queue>

using namespace std;

int w,h;
int trush[20][20];
bool map[20][20];
bool dp[20][20][1<<10];
int gomi,ans_bit;
int dir[4][2]{{1,0},{0,1},{-1,0},{0,-1}};

struct set{
  int y,x,bit;
};

int main() {
  while(true) {
    scanf("%d%d",&w,&h);
    if(w==0) break;
    int x,y;
    gomi = 0;
    for(int i = 0; i < h; i++) {
      char input[21];
      scanf("%s",input);
      for(int j = 0; input[j]!='\0'; j++) {
        trush[i][j]=(input[j]=='*')?gomi:-1;
        if(input[j]=='*') gomi++;
        map[i][j]=(input[j]=='x');
        if(input[j]=='o') {
          x = j;
          y = i;
        }
      }
    }
    ans_bit = (1<<gomi)-1;

    for(int i = 0; i < h; i++) {
      for(int j = 0; j < w; j++) {
        for(int k = 0; k < (1<<gomi); k++) {
          dp[i][j][k] = false;
        }
      }
    }

    int ans = 0;
    queue<set> q;
    q.push(set{y,x,0});
    dp[y][x][0] = true;
    bool ans_flag = false;
    while(!q.empty()&&!ans_flag) {
      ans++;
      int size = q.size();
      for(int loop = 0; loop < size; loop++) {
        set s = q.front();q.pop();
        if(s.bit==ans_bit) {
          ans_flag = true;
          ans--;
          break;
        }
        for(int d = 0; d < 4; d++) {
          int next_x = s.x+dir[d][0];
          int next_y = s.y+dir[d][1];
          if(next_x<0||next_x>=w) continue;
          if(next_y<0||next_y>=h) continue;
          int next_bit = s.bit;
          if(trush[next_y][next_x]>=0) {
            next_bit |= (1<<trush[next_y][next_x]);
          }
          if(!dp[next_y][next_x][next_bit]) {
            dp[next_y][next_x][next_bit] = true;
            if(!map[next_y][next_x]) {
              q.push(set{next_y,next_x,next_bit});
            }
          }
        }
      }
    }
    printf("%d\n",(ans_flag)?ans:-1);
  }
}



Measured memory_bytes: 3112
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;


void solve(){
  string s; cin >> s;
  for(int i = 0; i < 3; i++){
    if(s[i] == '1') cout << 9;
    else if(s[i] == '9') cout << 1;
    else cout << s[i];
  }
  cout << endl;
  return;
}

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


Measured memory_bytes: 256
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N;
  cin >> N;
  ll A[N];
  rep(i, N){
    int a;
    cin >> a;
    A[i] = a-i-1;
  }
  sort(A, A+N);
  ll ans = 0;
  rep(i, N){
    ans += abs(A[i] - A[N/2]);
  }
  cout << ans << endl;
}
    
    
  

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

int main() {
    int ans = 0;
    string s;
    cin >> s;
    for(int i = 0; i < s.size()/2; ++i) {
        if(s[i] != s[s.size()-i-1]) ans++;
    }

    cout << ans << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            in.nextLine();
            String s = in.nextLine();
            if (n % 2 == 1) {
                System.out.println("No");
            } else {
                n /= 2;
                System.out.println((s.substring(0, n).endsWith(s.substring(n))) ? "Yes" : "No");
            }
        }
    }
}

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

main() {
	int debug = 0;
	string s;
	cin >> s;
	vector <int> cnt(2019, 0);
	int ans = 0;
	rep(i, 0, s.size()) {
		int c = s[i] - '0';
		vector <int> cnt2(2019, 0);
		rep(j, 0, 2019) {
			cnt2[(j * 10 + c) % 2019] = cnt[j];
		}
		cnt2[c]++;
		cnt = cnt2;
		ans += cnt[0];
		if (debug) {
			cerr << " i: " << i << " cnt: " << cnt[0] << '\n';
		}
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3716
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        if(s.substring(0, n/2).equals(s.substring(n/2,n)) && n % 2 == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
N = int(input())
L = list(map(int,input().split()))
L.sort()
def gcd(x,y):
  while y != 0:
    k = x
    x = y
    y = k%y
  return  x
cur = L[0]
for i in range(N):
  cur = gcd(cur,L[i])
print(cur)

Measured memory_bytes: 15020
#include <stdio.h>

int main() {
	int h, w, a, b, ans;
	scanf("%d %d %d %d", &h, &w, &a, &b);
	ans = (h * w) - (a * w) - (h * b) + (a * b);
	printf("%d\n", ans);
	return 0;
}

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){
    bool flag=false;
    ll ans=0,sum=0;

    int n,q;
    string s;
    cin >>n>>s>>q;
    vector<set<int>> st(26);

    rep(i,n){
        int p = s[i]-'a';
        st[p].insert(i);
    }

    vector<int>qans;
    rep(i,q){
        int t;
        cin>>t;

        if(t==1){

            int iq;
            char cq;
            cin>>iq>>cq;--iq;

            st[s[iq]-'a'].erase(iq);
            s[iq]=cq;
            st[cq-'a'].insert(iq);

        }else{
            int l,r;
            int spec=0;
            cin>>l>>r;
            --l;--r;

            rep(i,26){
                auto it = st[i].lower_bound(l);
                if(it == st[i].end())continue;
                if(*it <= r)++spec;
            }
            qans.pb(spec);
        }
    }

    for(int a:qans)cout<<a<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;
    //cout<<ans<<endl;
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 24452
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int n,a[101];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	cout<<a[n]-a[1];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,m;
vector<string> v;
void solve(int x,string s)
{
	if(x==s.size())
	{
		v.push_back(s);
		return ;
	}
	int a[30];
	for(int i=0;i<15;i++)
		a[i]=0;
	for(int i=0;i<s.size();i++)
		a[s[i]-'a']++; 
	string s2;
	bool no=false;	
	for(int i=0;i<15;i++)
	{
		if(a[i]!=0)
		{
			s2= s+char(i+'a');
			solve(x,s2);
		}
		else if(a[i]==0 && no==false)
		{
		//	cout<<no<<" "<<char(i+'a')<<" "<<s<<endl;
			s2 = s+char(i+'a');
			no=true;
			solve(x,s2);
		}
	}	
	return ;
}
int main()
{
	cin>>n;
	string s;
	s="";
	solve(n,s);
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++)
		cout<<v[i]<<endl;
} 

Measured memory_bytes: 9588
#include <iostream>
#include <algorithm>
#include <set>
#define int long long
using namespace std;
void print(int p) {
	if (p < 100000) {cout << '0';
		if (p < 10000) {cout << '0';
			if (p < 1000) {cout << '0';
				if (p < 100) {cout << '0';
					if (p < 10) {cout << '0';
					}
				}
			}
		}
	}
	cout << p; return;
}
int n, m;
set<pair<int,int>> s[114514];//y,i
set<int>s1;
int p[114514], ans[114514];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int y; cin >> p[i] >> y;
		s[p[i]].insert(make_pair(y, i));
		s1.insert(p[i]);
	}
	for (auto i = s1.begin(); i != s1.end(); i++) {
		int cnt = 1;
		for (auto j = s[*i].begin(); j != s[*i].end(); j++) {
			ans[(*j).second] = cnt++;
		}
	}
	for (int i = 0; i < m; i++) {
		print(p[i]);
		print(ans[i]);
		cout << endl;
	}
}

Measured memory_bytes: 19328
#include <iostream>
#include <map>

using namespace std;

int main(int argc, char const *argv[])
{
    int n, l;
    cin >> n >> l;
    int total_sum = 0;
    for (int i = 1; i <= n; i++)
    {
        total_sum += l + i - 1;
    }
    int diff, min_diff = INT16_MAX, num;
    int new_tot;
    // cout << "total is :" << total_sum << endl;
    for (int i = 1; i <= n; i++)
    {
        new_tot = total_sum - (l + i - 1);
        diff = abs(total_sum - new_tot);
        // cout << "diff is :" << diff << endl;
        //diff = abs(total_sum-(total_sum - (l+i-1)));
        if (diff < min_diff)
        {
            min_diff = diff;
            num = l + i - 1;
        }
        min_diff = diff;
    }
    cout << total_sum - num;
    return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("avx") 
#include <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define re return
#define fi first
#define se second
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define sqrt(x) sqrt(abs(x))
#define y0 y3487465
#define y1 y8687969
#define j0 j5743892
#define j1 j542893
                         
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double D;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<vi> vvi;

template<class T> T abs(T x) { re x > 0 ? x : -x; }
template<class T> T gcd(T a, T b) { re a ? gcd (b % a, a) : b; }
template<class T> T sqr(T a) { re a * a; }
template<class T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }

const double pi = acos(-1.0);

#define filename ""

int n;
ll m;

int main () {
//  freopen (filename".in", "r", stdin);
//  freopen (filename".out", "w", stdout);
    cin >> n >> m;
    vi to(n + 1);
    for (int i = 1; i <= n; i++) cin >> to[i];
    vi d(n + 1);
    int x = 1;
    int cnt = 0;
    while (d[x] == 0 && cnt < m) {
        cnt++;
        d[x] = cnt;
        x = to[x];
    }
    if (cnt == m) {
        cout << x << endl;
        re 0;
    }
    int len = cnt - d[x] + 1;
    int ans = (m - d[x] + 1) % len;
    for (int i = 0; i < ans; i++) x = to[x];
    cout << x << endl;  
    return 0;
}


Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define all(n) (n).begin(),(n).end()
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  ll a,b,c=0,d=0,e,f,g,h,n,m,ans=0;
  int x[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin>>a;
  co(x[a-1]);
  
  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <typeinfo>
#include <queue>

using namespace std;

void iti_exe(){
	int n;
	int result = 0;
	//cin >> n;
	string s;
	cin >> s;
	n = s.size();
	string t = "CODEFESTIVAL2016";
	for(int i = 0; i < n; i++){
		if(s[i]!=t[i])
			result++;
	}
	cout << result << endl;
}


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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {


    private void solve(InputReader in, PrintWriter out) {
        int a = in.nextInt();
        int b = in.nextInt();
        out.println((a - 1) * (b - 1));
    }


    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        try (
                InputReader in = new InputReader(System.in);
                PrintWriter out = new PrintWriter(System.out)) {
            solve(in, out);
        }
    }


    static class InputReader implements AutoCloseable {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }


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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        @Override
        public void close() {

        }
    }


}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;


int main() {
  int a,b;cin >> a >> b;
  cout << 6-(a+b);
}

Measured memory_bytes: 256
def check(graph):
    import queue
    N = len(graph)
    tmp_position = [None] * N
    for i in range(N):
        if tmp_position[i] is None:
            tmp_position[i] = 0
            qu = queue.Queue()
            qu.put(i)
            while not qu.empty():
                now = qu.get()
                now_dist = tmp_position[now]
                for nxt, nxt_dist in graph[now]:
                    if tmp_position[nxt] is None:
                        tmp_position[nxt] = now_dist + nxt_dist
                        qu.put(nxt)
                    elif tmp_position[nxt] != now_dist + nxt_dist:
                        return False
    return True


N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    L, R, D = map(int, input().split())
    L-=1;R-=1
    graph[L].append((R, D))
    graph[R].append((L, -D))
print("Yes" if check(graph)else "No")

Measured memory_bytes: 66780
K = int(input())

P = [n for n in range(1, 10)]
Q = [n for n in range(1, 10)]
for d in range(20):
    if d < 12:
        for m in range(10, 100):
            P.append(int(str(m)+"9"*d))
            Q.append(m//10+m%10+9*d)
    else:
        for m in range(100, 1000):
            P.append(int(str(m)+"9"*(d-1)))
            Q.append(sum([int(s) for s in str(m)])+9*(d-1))

L = len(P)
c = 0
for i, (p, q) in enumerate(zip(P, Q)):
    ok = True
    for j in range(i+1, L):
        np, nq = P[j], Q[j]
        if np*q < nq*p:
            ok = False
            break
    if ok:
        print(p)
        c += 1
    if c == K:
        break


"""
import matplotlib.pyplot as plt

A = []
B = []
for n in range(-1+10**10, 10**14, 10**10):
    m = sum([int(s) for s in str(n)])
    A.append(n)
    B.append(n/m)


plt.plot(A, B)
plt.show()
"""

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

int main() {
    string s, t;
    cin >> s >> t;
    if ((s == t.substr(0, s.size())) && (t.size() - 1) == s.size()) cout << "Yes" <<endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3592
//https://atcoder.jp/contests/nikkei2019-qual/tasks/nikkei2019_qual_d
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class reverse_range {private:struct I {int x;int operator*() {return x-1;}bool operator!=(I& lhs) {return x>lhs.x;}void operator++() {--x;}};I i, n;public:reverse_range(int n) :i({ 0 }), n({ n }){}reverse_range(int i, int n) :i({ i }), n({ n }){}I& begin() {return n;}I& end() {return i;}};
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }reverse_range operator!(){return reverse_range(*i,*n);}};

int N,M;
vector<int> g[112345];
int vis[112345];
int o[112345];
int root= -1;
int t[112345];
void dfs(int v,int &id){
    vis[v]=1;
    for(int u:g[v])if(vis[u]==0)dfs(u,id);
    if(id==0)root = v;
    o[v]=id--;
}
void dd(int v){
    vis[v]=1;
    for(int u:g[v]){
        if(o[t[u]]<o[v]){
            t[u]=v;
        }
        if(vis[u])continue;
        dd(u);
    }
}
int main(){
    cin>>N>>M;
    for(int i:range(N+M-1)){
        int a,b;
        cin>>a>>b;
        g[a-1].push_back(b-1);
    }
    int id = N-1;
    for(int i:range(N)){
        if(vis[i]==0){
            dfs(i,id);
        }
    }
    for(int i:range(N)){
        t[i]=root;
        vis[i]=0;
    }
    dd(root);
    //for(int i:range(N))cout<<i<<" "<<o[i]<<endl;
    for(int i:range(N)){
        if(i!=t[i]){
            cout<<t[i]+1<<endl;
        }
        else cout<<0<<endl;
    }
    return 0;
}

Measured memory_bytes: 12416
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <pi, int>
#define vi vector <int>
const ll mod = 1000000007;
#define int ll
int n, m, a, b;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin>>n>>m>>a>>b;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            if((i<=b && j<=a) || (i>b && j>a)) cout<<0;
            else cout<<1;
        }
        cout<<"\n";
    }
}


Measured memory_bytes: 1280
package main

import "fmt"

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

	for i := 1; i<= 9; i++ {
		for j := 1; j <= 9; j++ {
			if i * j == N {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
        #include<iostream>
        #include<cstdio>
        #include<vector>
        #include<queue>
        #include<map>
        #include<cstring>
        #include<string>
        #include <math.h>
        #include<algorithm>
    //    #include <boost/multiprecision/cpp_int.hpp>
        #include<functional>
      #define int long long
        #define inf  1000000007
        #define pa pair<int,int>
#define ll long long
        #define pal pair<ll,ll>
        #define ppa pair<int,pa>
        #define  mp make_pair
        #define EPS (1e-10)
        #define equals(a,b) (fabs((a)-(b))<EPS)

        using namespace std;

        class Point{
        	public:
        	double x,y;
        	Point(double x=0,double y=0):x(x),y(y) {}
        	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
        	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
        	Point operator * (double a) {return Point(x*a,y*a);}
        	Point operator / (double a) {return Point(x/a,y/a);}
        	double absv() {return sqrt(norm());}
        	double norm() {return x*x+y*y;}
        	bool operator < (const Point &p) const{
        		return x != p.x ? x<p.x: y<p.y;
        	}
        	bool operator == (const Point &p) const{
        		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
        	}
        };
        typedef Point Vector;

        struct Segment{
        Point p1,p2;
        };

    double hen(Vector a){
    if(fabs(a.x)<EPS && a.y>0) return acos(0);
    else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
    else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
    else if(fabs(a.y)<EPS && a.x>0) return 0.0;
    else if(a.y>0) return acos(a.x/a.absv());
    else return 2*acos(0)+acos(-a.x/a.absv());

    }

        double dot(Vector a,Vector b){
        	return a.x*b.x+a.y*b.y;
        }
        double cross(Vector a,Vector b){
        	return a.x*b.y-a.y*b.x;
        }
        int dx[4] = {1, 0, -1, 0};
        int dy[4] = {0, 1, 0, -1};
        //----------------kokomade temple------------

int t[100002];




signed main(){
string s;
	cin>>s;
	int k;
	cin>>k;
	int n=s.length();
	for(int i=0;i<n;i++){
	//	cout<<s<<" "<<k<<endl;
		if(k==0) break;
		
		if(i==n-1){
			s[i]= (((s[i]-'a')+k%26)%26) +'a';
		break;
		}
		
		if(s[i]=='a') continue;
		if(k>('z'-s[i])){
	//		s[i]='a';
			k -= ('z'-s[i]+1);
			s[i]='a';
			continue;
		}
		else continue;
	
	
	}
	
	
	cout<<s<<endl;
	
	return 0;
}

//printf("%.10f\n",ans);


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
from collections import defaultdict
d = defaultdict(int)

ans=1
for num in a:
    if num==0:
        last_cnt=3
        tmp = last_cnt - d[num]
    else:
        last_cnt=d[num-1]
        tmp = last_cnt - d[num]

        if tmp == 0:
       #     tmp=1
            ans=0
    ans*=tmp
    ans%=1000000007
    d[num]+=1

print(ans)

Measured memory_bytes: 62124
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int L=sc.nextInt();
		int A=sc.nextInt();
		int B=sc.nextInt();
		int C=sc.nextInt();
		int D=sc.nextInt();
		int kokugoday=A/C;
		int sansuday=B/D;
		if(A%C!=0){
			kokugoday++;
		}
		if(B%D!=0){
			sansuday++;
		}
		if(kokugoday<sansuday){
			System.out.println(L-sansuday);
		}
		else{
			System.out.println(L-kokugoday);
		}
	}
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL){
    x=x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while(x->right!=NIL){
    x=x->right;
  }
  return x;
}

Node treeSearch(Node u, int k){
  if(k==u->key && u==NIL) return u;
  else if(k<u->key) return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
}

Node treeSuccessor(Node x){
  Node a;
  if(x->right!=NIL) return treeMinimum(x->right);
  a=x->parent;
  while(x==a->right && a!=NIL){
    x=a;
    a=a->parent;
  }
  return a;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->right==NIL || z->left==NIL)  y=z;
  else y=treeSuccessor(z);
  if(y->left!=NIL) x=y->left;
  else x=y->right;
  if(x!=NIL) x->parent = y->parent;
  if(y->parent==NIL) root=x;
  else if(y==y->parent->left) y->parent->left=x;
  else y->parent->right=x;
  if(y!=z) z->key=y->key;
}


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 while(x!=NIL){
    y=x;
    if(z->key<x->key) x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL) root=z;
  else if(z->key<y->key) y->left=z;
  else y->right=z;
}

void inorder(Node u){
  if(u!=NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}
void preorder(Node u){
if(u!=NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}

int find_tree(struct node* node,int key)
{
  if (node!=NULL) {
    if (node->key>key) {
      return find_tree(node->left,key);
    } else if (node->key<key) {
      return find_tree(node->right,key);
    } else {
      return 1;
    }
  }
  return 0;
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = find_tree(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20452
import numpy as np

N, M = map(int, input().split())
ls = np.empty(M)
rs = np.empty(M)


for i in range(M):
    l, r = map(int, input().split())
    ls[i] = l
    rs[i] = r

if 0 <= (np.min(rs) - np.max(ls)):
    print(int(np.min(rs) - np.max(ls) + 1))
else:
    print(0)


Measured memory_bytes: 15816
n,m,k=map(int,input().split())
mod = 998244353

fac = [0]*(n+1)
per = [0]*(n+1)

fac[0]=1
per[0] = 1
for i in range(1,n+1):
    fac[i] = fac[i-1]*i%mod
    per[i] = pow(fac[i],mod-2,mod)

def nCk(n,k):
    return fac[n]*per[k]%mod*per[n-k]%mod

ans = 0
for i in range(k+1):
    if i == 0:
        ans += m*pow(m-1,n-1-i,mod)%mod
    else:
        ans += m*pow(m-1,n-1-i,mod)%mod * nCk(n-1,i)%mod
    ans %= mod
print(ans)

Measured memory_bytes: 74036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	string s;
	cin>>s;
	ll k;
	cin>>k;
	ll b=s.size();
	ll a=min(k,b);
	for(int i=0;i<a;i++){
		if(s[i]=='1'){
			continue;
		}
		else{
			cout <<s[i];
			return 0;
		}
	}
	cout << 1;
	return 0;
}

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

int main() {
  ll n,m;
  while(cin >> n >> m && n) {
    double x=(1+n)*n/2,y=n;
    ll a[m];
    for(int i=0; i<m; i++)cin >> a[i];
    for(int t=1; t<(1<<m); t++) {
      ll z=1;
      for(int i=0; i<m; i++) {
        if(t&(1<<i)) z=z/__gcd(z,a[i])*a[i];
      }
      ll b=n/z;
      z=(z+b*z)*b/2;
      if(__builtin_popcount(t)%2) {
        x-=z;
        y-=b;
      } else {
        x+=z;
        y+=b;
      }
    }
    if(!y) x=0,y=1;
    printf("%.10f\n",x/y);
  }
  return 0;
}


Measured memory_bytes: 1196
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

bool solve(int n) 
{
    int cnt = 0;
    while(n) {
        cnt++;
        n /= 10;
    }
    if(cnt%2 == 1) { 
        return true;
    } else {
        return false;
    }
}

int main(void)
{
    int n;
    cin >> n;

    int ans = 0;
    
    irep2(i,1,n) {
        if(solve(i)) { ans++; }
    }
    cout << ans << endl;
    return 0;
} /*atcoder*/



Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
const int inf = (signed)(~0u >>2);
typedef struct{ //这种方式可以像int,double原生类一样使用
    int l,r;
}Segment;//这里没有使用构造函数的方式进行初始化，可以用{}的方式在外部初始化
Segment operator & (Segment &a,Segment &b){
    return {max(a.l,b.l),min(a.r,b.r)};
}
int len(Segment &a){
    return max(a.r-a.l+1,0);
}
bool operator <(Segment &a,Segment &b){
    return a.r<b.r;
}

int n;Segment s[N],sl[N],sr[N];

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>s[i].l>>s[i].r;
    sort(s+1,s+n+1);
    int ans=0;
    sl[0].l=0;sl[0].r=inf;
    //cout<<"sl: "<<endl;
    for(int i=1;i<=n;i++){
        sl[i]=sl[i-1] & s[i];
        //cout<<sl[i].l<<" "<<sl[i].r<<endl;
    }
    sr[n+1].l=0;sr[n+1].r=inf;
    //cout<<"sr: "<<endl;
    for(int i=n;i;i--){
        sr[i]=sr[i+1] & s[i];
        //cout<<sr[i].l<<" "<<sr[i].r<<endl;
    }
    for(int i=1;i<n;i++)
        ans= max(ans,len(sl[i])+len(sr[i+1]));
    //cout<<endl;
    for(int i=1;i<=n;i++){
        Segment a=sl[i-1] & sr[i+1];
        //cout<<len(s[i])<<" "<<len(a)<<endl;
        ans = max(ans,len(s[i])+len(a));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2688
#include<stdio.h>

int main(){
  
  int i;
  int x[5];
  
  for(i = 0; i < 5; i++){
    scanf("%d",&x[i]);
    
    if(x[i] == 0){
      printf("%d\n",i+1);
      break;
    }     
  }
  
  return 0;
        
}

Measured memory_bytes: 1680
#pragma comment(linker, "/STACK:640000000")
#include <bits/stdc++.h>

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);

int main() {
	#ifdef LOCAL
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
	#endif

	int n, m; cin >> n >> m;

	if (n == 1) {
		if (m == 1) {
			cout << 1 << endl;
		} else {
			cout << m - 2 << endl;
		}
	} else {
		if (m == 1) {
			cout << n - 2 << endl;
		} else {
			cout << (n - 2) * 1LL * (m - 2) << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
 
#define ll long long
using namespace std;

int main(){
    int N,K;
    cin >> N >> K;
    vector<ll> h(N);
    for(int i=0;i<N;i++){
        cin >> h.at(i);
    }
    vector<ll> dp(N);
    dp[0] = 0;
    
    for(int i=1;i<N;i++){
        ll minval = 1e30+1;
        for(int j=max(0,i-K);j<i;j++){
            ll tmp = dp[j]+abs(h[i]-h[j]);
            if(tmp < minval) minval = tmp;
        }
        dp[i] = minval;
    }
    cout << dp[N-1] << endl;
    
    return 0;
}

Measured memory_bytes: 1792
import { ifError } from "assert";

const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1];}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const objvs =(a)=>{const b=[];for(const v in a){b.push(a[v])}return b};
const main=()=>{
  let n=tn()
  let s=ts().split('')
  let ans=0
  for(let i=1;i<n-1;i++){
    let t={}
    for(let j=0;j<i;j++){
      for(let k=i;k<n;k++){
        if(s[j]==s[k])t[s[j]]=true
      }
    }
    ans=max(Object.keys(t).length,ans)
  }
  to(ans)
}
main()


Measured memory_bytes: 11468
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  string s;
  getline(cin,s);
  for(int i=0; i<s.size(); i++) {
      if(s[i]>='a'&&s[i]<='z') {
          s[i]=s[i]+'A'-'a';
      }
      else if(s[i]>='A'&&s[i]<='Z') {
          s[i]=s[i]+'a'-'A';
      }
  }
  cout << s << endl;
}


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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(x) begin(x),end(x)

using namespace std;

class BipartiteMatching {
  int V;
  vector<vector<int>> g;
  vector<int> match;
  vector<bool> used;
  bool dfs(int v) {
    used[v] = true;
    for (int u: g[v]) {
      int w = match[u];
      if (w < 0 || (!used[w] && dfs(w))) {
        match[v] = u; match[u] = v;
        return true;
      }
    }
    return false;
  }
public:
  BipartiteMatching (int v) : V(v), g(v), match(v), used(v) {}
  void add_edge(int u, int v) {
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int maximum_matching(void) {
    int res = 0;
    fill (ALL(match), -1);
    REP(v, V) {
      if (match[v] < 0) {
        fill (ALL(used), 0);
        if (dfs(v)) res++;
      }
    }
    return res;
  }
};

int main() {
  while(1){
    int h,w;
    cin>>h>>w;
    if(!h)break;
    vector<string> t(h);
    REP(i,h)cin>>t[i];
    int res = 1;
    vector<vector<int>> p(h-1,vector<int>(w-1, 0));
    REP(i,h-1)REP(j,w-1) {
      REP(k,2)REP(l,2) {
        if (t[i+k][j+l] == '#') ++p[i][j];
      }
      if (p[i][j] == 3) ++res;
    }
    using E = tuple<int, int, int>;
    vector<E> eh, ev;
    REP(i,h-1)REP(j,w-1) {
      if (p[i][j] == 3) {
        if (t[i][j] == '.' || t[i+1][j] == '.') {
          for (int k = j+1; k < w-1; ++k) {
            if (p[i][k] == 3) {
              eh.emplace_back(i, j, k);
            }
            if (p[i][k] < 4) break;
          }
        }
        if (t[i][j] == '.' || t[i][j+1] == '.') {
          for (int k = i+1; k < h-1; ++k) {
            if (p[k][j] == 3) {
              ev.emplace_back(i, j, k);
            }
            if (p[k][j] < 4) break;
          }
        }
      }
    }
    int n = eh.size() + ev.size();
    BipartiteMatching bm(n);
    REP(a, eh.size()) {
      int i,j,k;
      tie(i,j,k) = eh[a];
      REP(b, ev.size()) {
        int p,q,r;
        tie(p, q, r) = ev[b];
        if (p <= i && i <= r && j <= q && q <= k) {
          bm.add_edge(a, eh.size() + b);
        }
      }
    }
    res -= n - bm.maximum_matching();
    cout << res << endl;
  }
  return 0;
}

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

int main()
{
	int n, m, l, a[100][100] = {}, b[100][100] = {};
	long c[100][100] = {};


	cin >> n >> m >> l;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> b[i][j];
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			for (int k = 0; k < l; k++) {
				c[i][k] += a[i][j] * b[j][k];
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l - 1; j++) {
			cout << c[i][j] << " ";
		}
		cout << c[i][l - 1] << endl;
	}

	return 0;
}

Measured memory_bytes: 1324
pub fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();

    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    line.trim()
        .split_whitespace()
        .map(|x| x.parse::<T>())
        .collect::<Result<Vec<T>, _>>()
        .map_err(|_| format!("{}", "parse error"))
}

fn main() {
    let z = read_parameters::<usize>().unwrap();
    let (n, m, l) = (z[0], z[1], z[2]);

    let mut a = Vec::with_capacity(n);
    for _ in 0..n {
        let raw = read_parameters::<usize>().unwrap();
        a.push(raw);
    }

    let mut b = Vec::with_capacity(m);
    for _ in 0..m {
        let raw = read_parameters::<usize>().unwrap();
        b.push(raw);
    }

    let mut c = Vec::with_capacity(n);
    for i in 0..n {
        let mut raw = Vec::with_capacity(l);
        for j in 0..l {
            let mut sum = 0;
            for k in 0..m {
                sum += a[i][k] * b[k][j];
            }
            raw.push(sum);
        }
        c.push(raw);
    }

    for i in 0..n {
        for j in 0..l - 1 {
            print!("{} ", c[i][j]);
        }
        println!("{}", c[i][l - 1]);
    }
}



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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int x, a, b;
  std::cin >> x >> a >> b;
  if (a >= b)
    std::cout << "delicious" << std::endl;
  else if (a + x >= b)
    std::cout << "safe" << std::endl;
  else
    std::cout << "dangerous" << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int n, C, x;
    cin >> n >> C;

    vector<vector<int>> D(C, vector<int>(C));
    rep(i, C) {
        rep(j, C) {
            cin >> D[i][j];
        }
    }

    vector<vector<int>> t(3, vector<int>(C));
    rep(i, n) {
        rep(j, n) {
            cin >> x;
            x--;
            t[(i+j)%3][x]++;
        }
    }

    int ans = 1e9;
    rep(i, C) {
        rep(j, C) {
            if(i != j) {
                rep(k, C) {
                    if(i != k && j != k) {

                        int cnt = 0;
                        rep(l, C) {
                            cnt += D[l][i]*t[0][l];
                        }
                        rep(l, C) {
                            cnt += D[l][j]*t[1][l];
                        }
                        rep(l, C) {
                            cnt += D[l][k]*t[2][l];
                        }

                        if(ans > cnt) {
                            ans = cnt;
                        }
                    }
                }
            }
        }
    }

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

Measured memory_bytes: 384