akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<58;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

string s;

int main(){
	cin>>s;
	int n=s.size();
	ll res=1;
	vi a(26);
	for(int i=0;i<n;i++){
		for(int j=0;j<26;j++) if(j!=s[i]-'a') res+=a[j];
		a[s[i]-'a']++;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int H, W, D;

int main()
{
	scanf("%d%d%d", &H, &W, &D);
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			int mode = 0;
			mode |= (i + j) / D % 2;
			mode |= (H - 1 - i + j) / D % 2 * 2;

			printf("%c", "RYGB"[mode]);
		}
		puts("");
	}
	return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	int i,j,hi=0,bl=0;
	int a[4],b[4];
	
	 while(scanf("%d",&a[0])!=EOF){
		hi=0;
		bl=0;
        for(i=1;i<4;i++)
            scanf("%d",&a[i]);
        for(i=0;i<4;i++)
            scanf("%d",&b[i]);
		
		for(i=0;i<4;i++)
			if(a[i]==b[i])
				hi++;
		for(i=0;i<4;i++)
			for(j=0;j<4;j++)
				if(a[i]==b[j]&&i!=j)
					bl++;

		printf("%d %d\n",hi,bl);
	}
	return 0;
}

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

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

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

int main()
{
    vector<int> h(5);
    while(cin >> h[0] && h[0])
    {
        REP(i, 1, 5) cin >> h[i];

        set<int> s;

        rep(i, 5) s.insert(h[i]);

        if(!s.count(1) && s.count(2) && s.count(3))
        {
            rep(i, 5)
            {
                cout << (h[i] == 2 ? 1 : 2) << endl;
            }
        }
        else if(!s.count(2) && s.count(1) && s.count(3))
        {
            rep(i, 5)
            {
                cout << (h[i] == 3 ? 1 : 2) << endl;
            }
        }
        else if(!s.count(3) && s.count(1) && s.count(2))
        {
            rep(i, 5)
            {
                cout << (h[i] == 1 ? 1 : 2) << endl;
            }
        }
        else
        {
            rep(i, 5) cout << 3 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3072
N = int(input())
P = {}
for i in range(N):
    p = float(input())
    P.setdefault(p, []).append(i)

ans = [0]*N
c = 0
for p, s in sorted(P.items()):
    for i in s:
        ans[i] = 3*c + len(s)-1
    c += len(s)
print(*ans, sep='\n')



Measured memory_bytes: 15068
from itertools import accumulate
N,X = map(int,input().split())
listA = list(map(int,input().split()))

B = [0] + listA
B = list(accumulate(B)) 
cnt = 0
for i in range(len(B)):
    if B[i] <=  X:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064
using System;
class p
{
  static void Main()
  {
    string[] input = Console.ReadLine().Split(' ');
    int N = int.Parse(input[0]);
    int K = int.Parse(input[1]);
    int[] trees = new int[N];
    for (int i = 0; i < N; i++) {
      trees[i] = int.Parse(Console.ReadLine());
    }
    Array.Sort(trees);
    Array.Reverse(trees);
    int min = int.MaxValue;
    for (int i = 0; i < N-K+1; i++) {
      min = Math.Min(min, Math.Abs(trees[i]-trees[i+K-1]));
    }
    Console.WriteLine(min);
  }
}

Measured memory_bytes: 15452
import java.util.*;

public class Main{
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    
    int n = (int)Math.pow((K-1),(N-1));
    int k = K*n;
    
    System.out.println(k);
  }  
}

Measured memory_bytes: 35868
AC=0
WA=0
TLE=0
RE=0
n=int(input())
for i in range(n):
    s=input()
    if s=="AC":
        AC+=1
    elif s=="WA":
        WA+=1
    elif s=="TLE":
        TLE+=1
    elif s=="RE":
        RE+=1
print("AC x "+str(AC))
print("WA x "+str(WA))
print("TLE x "+str(TLE))
print("RE x "+str(RE))

Measured memory_bytes: 9188
N = int(input())
h = [int(s) for s in input().split()]
dp = [0]*N
for i in range(N):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[i] = abs(h[i]-h[i-1])+dp[i-1]
    else:
        dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])

print(dp[N-1])


Measured memory_bytes: 13928
//
import java.math.*;
import java.util.*;
import java.io.*;
  
public class Main { 
  
    static BufferedReader in;
    static PrintWriter out = new PrintWriter(System.out);
    static String file = "../in";
    static int test = 10; // 0 for local testing, 1 for std input
    static int inf = 1_000_000, mod = 1_000_000_007;



    void swap(int[]ary, int i, int j)
    {
        int t = ary[i];
        ary[i] = ary[j];
        ary[j] = t;
    }
    
    String[] split() throws Exception
    {
        return in.readLine().split(" ");
    }

    int readInt() throws Exception
    {
        return Integer.valueOf(in.readLine());
    }

    long[] toLongArray() throws Exception
    {
        String[] sp = split();
        int n = sp.length;
        long[] ary = new long[n];
        for(int i = 0; i < n; i++) ary[i] = Long.valueOf(sp[i]);
        return ary;
    }

    int[] toIntArray() throws Exception
    {
        String[] sp = split();
        int n = sp.length;
        int[] ary = new int[n];
        for(int i = 0; i < n; i++) ary[i] = Integer.valueOf(sp[i]);
        return ary;
    }

    String reverse(String str)
    {
        return new StringBuilder(str).reverse().toString();
    }


    long pow(long a, int pow)
    {
        long res = 1;
        while(pow > 0)
        {
            if(pow % 2 != 0) {
                res *= a;
                res %= mod;
            }
            a = a * a;
            a %= mod;
            pow /= 2;
        }

        return res;
    }

    public static void main(String[] args) throws Exception
    {
        int _k = Integer.valueOf("1");
        if(test > 0) in = new BufferedReader(new InputStreamReader(System.in));
        else in = new BufferedReader(new FileReader(file));
        if(test < 0) {String[] str = in.readLine().split(" ");}
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
/***********************************************************************/
        // System.out.println((-100 + 0) / 2);

        
        new Main().b();

        
        out.flush();
    }

    void b() throws Exception
    {
        String str = in.readLine();
        int n = str.length();
        String sub1 = str.substring(0, (n - 1) / 2);
        String sub2 = str.substring((n + 3) / 2 - 1, n);
        // System.out.println(sub1);
        // System.out.println(sub2);

        if(isPalin(str) && isPalin(sub1) && isPalin(sub2)) out.println("Yes");
        else out.println("No");
    }

    boolean isPalin(String str)
    {
        int i = 0, j = str.length() - 1;
        while(i < j && str.charAt(i) == str.charAt(j))
        {
            i++;
            j--;
        }
        return i >= j;
    }

    void a() throws Exception
    {
        int[] ary = toIntArray();
        int a = ary[0], b = ary[1];

        int re = a * (a - 1) / 2 + b * (b - 1) / 2;

        out.println(re);
    }
}

Measured memory_bytes: 21332
//package AtCoder;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		if(s.equals(u))
			a-=1;
		else
			b-=1;
		System.out.println(a+" "+b);

	}

}


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

int main() {
  int N;
  cin >> N;
  
  int A=0, B=0, C=0;
  A = N;
  while(A >= 1){
    B = A - A /10 *10;
    C += B;
    A /= 10;
  }
  
  if(N % C == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  
}

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

using namespace std;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

int n,m;
int g[25][21];

int subedge[1<<15][15];

int dp[1<<15][15];

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n)REP(j,n)g[i][j]=-1025830252;
  REP(i,m){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    --a;--b;
    g[a][b] = g[b][a] = c;
  }
  // calc subset edge sum
  REP(i,1<<n){
    REP(j,n)if((i>>j)&1)REP(k,j)if((i>>k)&1){
      if(g[j][k]>=0)subedge[i][0] += g[j][k];
    }
    FOR(j,1,n)subedge[i][j] = subedge[i][0];
    REP(j,n){
      REP(k,n)if((i>>k)&1){
        subedge[i][j] += max(0,g[j][k]);
      }
    }
  }
  // calc answer
  int ans = 0;
  REP(i,1<<n)REP(j,n)dp[i][j] = -1025830252;
  dp[1][0] = 0;
  REP(mask,1<<n)REP(i,n)if(dp[mask][i]>=0){
    if(i==n-1){
      CHMAX(ans,dp[mask][i]);
    }
    // next terminal
    REP(to,n)if(((mask>>to)&1)==0 && g[i][to]>=0){
      CHMAX(dp[mask|(1<<to)][to], dp[mask][i]+g[i][to]);
    }
    // terminal add
    int neg = (~mask) & ((1<<n)-1);
    for(int s=neg;s>0;s=(s-1)&neg){
      CHMAX(dp[mask|s][i], dp[mask][i]+subedge[s][i]);
    }
  }

  int total = 0;
  REP(i,n)REP(j,i)total+=max(0,g[i][j]);
  printf("%d\n",total-ans);
  return 0;
}


Measured memory_bytes: 4096
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line: Vec<i32> = read_as_vec();
    let (n, l) = (line[0], line[1]);

    let sum = n*(n-1)/2 + n*l;
    let mut min_taste: i32 = 400;
    for i in 0..n{
        if (l+i).abs() < min_taste.abs(){
            min_taste = l+i;
        }
    }
    println!("{}", sum-min_taste);
}
    


Measured memory_bytes: 4352
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef tuple<ll, ll, ll> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a, b; cin >> a >> b;
    if(1 <= a && a <= 9 && 1 <= b && b <= 9){
        cout << a*b << endstr;
    }
    else{
        cout << -1 << endstr;
    }
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var a, b int
	fmt.Scanf("%d %d\n", &a, &b)

	if (b-1)%(a-1) == 0 {
		fmt.Println((b - 1) / (a - 1))
	} else {
		fmt.Println((b-1)/(a-1) + 1)
	}
}


Measured memory_bytes: 1832
#include<iostream>
#include<vector>
#define NINF -1000000000000
#define INF   1000000000000
using namespace std;
typedef long long ll;
struct Ed{
  int to,cost;
  Ed(int a,int b){
    to=a;
    cost=b;
  }
};
int main(){
  ll n,m,p,a,b,t=1,c,loss,diff;
  ll d[2501];
  bool chan;
  fill(d,d+2501,NINF);
  d[1]=0;
  vector<Ed> G[5001];
  cin >> n >> m >> p;
  for(int i=0;i<m;i++){
    cin >> a >> b>>c;
    G[a].push_back(Ed(b,c));
  }
  while(t<=n-1){
    loss=t*p;
    for(int i=1;i<=n;i++){
      if(d[i]==NINF) continue;
      for(int j=0;j<G[i].size();j++){
        if(d[G[i][j].to]<d[i]+G[i][j].cost-p){
          d[G[i][j].to]=d[i]+G[i][j].cost-p;
        }
      }
    }
    t++;
  }
  chan = false;
  t=1;
  while(t<=n-1){
    loss=t*p;
    for(int i=1;i<=n;i++){
      if(d[i]==NINF) continue;
      for(int j=0;j<G[i].size();j++){
        if(d[G[i][j].to]<d[i]+G[i][j].cost-p){
          d[G[i][j].to]=INF;
        }
      }
    }
    t++;
  }
  if(d[n]==INF) cout << -1<<endl;
  else cout << max(ll(0),d[n]) <<endl;
}


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

typedef long long ll;

const int MAXN = 3002;

ll dp[MAXN][MAXN];
bool vis[MAXN][MAXN];
int A[MAXN],N;

ll solve(int i,int j){

	if(vis[i][j]) return dp[i][j];

	vis[i][j] = 1;

	if(i == j) return dp[i][j] = A[i];

	return dp[i][j] = max(A[i] - solve(i+1,j), A[j] - solve(i,j-1));

}

int main(){

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

	cout << solve(1,N) << endl;

	return 0;

}

Measured memory_bytes: 58708
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/

const ll MOD=1000000007;

ll min(ll a, ll b){
	if(a>=b){
		return b;
	}
	else{
		return a;
	}
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

ll Factorial(ll n)
{
	ll a=1;
	for (ll i = 1; i <= n; i++)
	{
		a *= i;
		a %= MOD;
	}
	return a;
}
void solve()
{
	string s;
	cin >> s;
	if(s[s.size()-1]=='s'){
		cout << s << "es" << endl;
	}
	else{
		cout << s << "s" << endl;
	}
}

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

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
 
using namespace std;
 
typedef long long ll;
 
const ll INF = 1e9, MOD = 1e9 + 7, MOD2 = 1e6 + 3;

int p[1000000], u[100], n, m;

vector <int> g[1000000];

int v[100][100], a[100][100];

bool kuhn (int x)
{
	if (u[x]) return false;
	u[x] = 1;

	for (int to : g[x])
		if (p[to] == -1 || kuhn (p[to]))
		{
			p[to] = x;
			return true;
		}

	return false;
}

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

	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			scanf ("%d", &a[i][j]);

	for (int k = 0; k < m; k++)
	{
		memset (p, -1, sizeof (p));

		for (int i = 0; i < n; i++)
		{
			g[i].clear ();
			for (int j = k; j < m; j++)
			{
				int d = (a[i][j] - 1) / m;
				g[i].push_back (d);
			}
		}

		for (int i = 0; i < n; i++)
		{
			kuhn (i);
			memset (u, 0, sizeof (u));
		}

		vector <int> to (n);

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

		for (int i = 0; i < n; i++)
			for (int j = k; j < m; j++)
			{
				if ((a[i][j] - 1) / m == to[i])
				{
					swap (a[i][k], a[i][j]);
					break;
				}
			}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
			printf ("%d ", a[i][j]);
		putchar ('\n');
	}

	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			v[(a[i][j] - 1) / m][j] = a[i][j];

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
			printf ("%d ", v[i][j]);
		putchar ('\n');
	}
}

Measured memory_bytes: 27776
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<stdlib.h>
#include<math.h>
using namespace std;
typedef long long ll;
map<ll, vector<ll> >sx, sy;
map<ll, set<ll> >mx, my;
typedef pair<ll, ll>pii;
set<pii>ans;
ll dist;
void dfs(ll x, ll y)
{
	ans.insert(make_pair(x, y));
	vector<pii>v;
	set<ll>::iterator it = mx[x + dist].lower_bound(y - dist);
	for (;;)
	{
		if (it == mx[x + dist].end())break;
		if ((*it) > y + dist)break;
		ll ny = *it;
		mx[x + dist].erase(it++);
		v.push_back(make_pair(x + dist, ny));
	}
	it = mx[x - dist].lower_bound(y - dist);
	for (;;)
	{
		if (it == mx[x - dist].end())break;
		if ((*it) > y + dist)break;
		ll ny = *it;
		mx[x - dist].erase(it++);
		v.push_back(make_pair(x - dist, ny));
	}
	it = my[y + dist].lower_bound(x - dist);
	for (;;)
	{
		if (it == my[y + dist].end())break;
		if ((*it) > x + dist)break;
		ll nx = *it;
		my[y + dist].erase(it++);
		v.push_back(make_pair(nx, y + dist));
	}
	it = my[y - dist].lower_bound(x - dist);
	for (;;)
	{
		if (it == my[y - dist].end())break;
		if ((*it) > x + dist)break;
		ll nx = *it;
		my[y - dist].erase(it++);
		v.push_back(make_pair(nx, y - dist));
	}
	for (int i = 0; i < v.size(); i++)dfs(v[i].first, v[i].second);
}
int main()
{
	int num, s1, s2;
	scanf("%d%d%d", &num, &s1, &s2);
	s1--, s2--;
	vector<pii>pts;
	for (int i = 0; i < num; i++)
	{
		ll za, zb;
		scanf("%lld%lld", &za, &zb);
		ll a = za - zb, b = za + zb;
		mx[a].insert(b);
		my[b].insert(a);
		pts.push_back(make_pair(a, b));
	}
	dist = max(abs(pts[s1].first - pts[s2].first), abs(pts[s1].second - pts[s2].second));
	dfs(pts[s1].first, pts[s1].second);
	dfs(pts[s2].first, pts[s2].second);
	set<pii>::iterator it = ans.begin();
	for (;;)
	{
		if (it == ans.end())break;
		pii z = *it;
		sx[z.first].push_back(z.second);
		sy[z.second].push_back(z.first);
		it++;
	}
	ll ret = 0;
	it = ans.begin();
	for (;;)
	{
		if (it == ans.end())break;
		pii z = *it;
		//printf("%lld %lld\n", z.first, z.second);
		ret += upper_bound(sx[z.first + dist].begin(), sx[z.first + dist].end(), z.second + dist - 1) - lower_bound(sx[z.first + dist].begin(), sx[z.first + dist].end(), z.second - dist);
		ret += upper_bound(sy[z.second + dist].begin(), sy[z.second + dist].end(), z.first + dist) - lower_bound(sy[z.second + dist].begin(), sy[z.second + dist].end(), z.first - dist + 1);
		it++;
	}
	printf("%lld\n", ret);
}

Measured memory_bytes: 89840
n = int(input())
a = list(map(int, input().split()))
while True:
  a.sort()
  t = sum(a)
  for i in range(1, len(a)):
    if a[i] % a[0] == 0:
      a[i] = a[0]
    else:
      a[i] = a[i] % a[0]
  if sum(a) == t:
    break
print(a[0])

Measured memory_bytes: 14224
def resolve():
    n = int(input())
    s = input()
    r = [0] * n
    g = [0] * n
    b = [0] * n
    for i in range(n):
        if s[i] == "R":
            r[i] = 1
        elif s[i] == "G":
            g[i] = 1
        else:
            b[i] = 1
    ans = sum(r)*sum(g)*sum(b)

    for i in range(1, n // 2 + 1):
        j = 0
        while j + 2 * i <= n - 1:
            if {s[j], s[j + i], s[j + 2 * i]} == {"R", "G", "B"}:
                ans -= 1
            j += 1
    print(ans)
resolve()

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

int main() {
  int a,b;
  cin>>a>>b;
  int x=0;
  while (x<10000) {
    x++;
    if (a==floor(x*0.08) and b==floor(x*0.1)) {
      cout<<x;
      return 0;
    }
  }
  cout << -1;
}


Measured memory_bytes: 256
k=[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]
n=int(input())
print(k[n-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll const mod=1e9+7;
double const pi=acos(-1); 
int main()
{
    int k,n,m;
    cin>>k;
    cin>>n>>m;
    int flag=0;
    for(int i=n;i<=m;i++)
    {
    	if(i%k==0)
    	{
    		flag=1;
    		cout<<"OK"<<endl;
    		break;
		}
	}
    if(flag==0)
    {
    	cout<<"NG"<<endl;
	}
	
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <deque>
#include <vector>
#include <map>
#include <math.h>
#include <limits.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> vec(n);
    int last, ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> vec[i];
        if (i == 0) {
            last = vec[i];
            ans++;
        }
        else if (vec[i] <= last) {
            last = vec[i];
            ans++;
        }
    }
    cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<(int)n; i++)
    
int main(){
    int p[3]; cin >> p[0] >> p[1] >> p[2];
    sort(p, p+3);
    cout << p[0] + p[1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pl = pair<ll,ll>;

const ll INF = 100000000000LL;
ll mul(ll x, ll y)
{
    if(x==0 || y==0) return 0;

    // x*y>INF
    if(x>INF/y) return INF;
    return x*y;
}

ll solve()
{
    int n;
    cin >>n;

    ll H,A,D,S;
    cin >>H >>A >>D >>S;

    vector<ll> h(n),a(n),d(n),s(n);
    rep(i,n) cin >>h[i] >>a[i] >>d[i] >>s[i];

    ll ret = 0;

    vector<pl> e;
    rep(i,n)
    {
        ll damage = max(0LL, a[i]-D);
        ll dd = max(0LL, A-d[i]);

        if(damage>0 && dd==0) return -1;

        if(dd>0)
        {
            ll turn = (h[i]+dd-1)/dd;
            if(S>s[i]) ret -= damage;

            e.pb({damage,turn});
        }
    }

    sort(all(e),[](const pl &l, const pl &r){ return l.fi*r.se > l.se*r.fi; });

    ll T = 0;
    rep(i,e.size())
    {
        T += e[i].se;
        ret += mul(e[i].fi,T);

        if(ret >= H) return -1;
    }

    return ret;
}

int main()
{
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 5020
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;

#define max(a,b) ((a>b)?(a):(b))
#define min(a,b) ((a<b)?(a):(b))

bool ok(int a){
  for(int i=2;i<a;i++){
    if(a%i==0){
      return false;
    }
  }
  return true;
}


int main(){
  int n;
  cin >> n;
  int count=0;
  for(int i=6;i<11111;i++){
    if(ok(5*i+1)){
      cout << 5*i+1;
      count++;
      if(count<n){
        cout << " ";
      }else{
        cout << endl;
        return 0;
      }
    }
  }
  return 0;
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;

int main(){
    string s,t; cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    // cout<<s<<endl;
    // cout<<t<<endl;
    rep(i,min(s.size(),t.size())){
        if(s[i]<t[i]){
            cout<<"Yes"<<endl;
            return 0;
        }else if(s[i]==t[i])continue;
        else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    if(s.size()>=t.size()){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
    return 0;
}


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

using namespace std;

int main(){
    int n,x,count=1;
    cin >>n >>x;
    vector<int> l(n);

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

    for(int i=0;i<n;i++){
        if((x-=l[i]) >=0){
            count++;

        }else{
            break;
        }

    }
    cout << count<<endl;

}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(ll i=a;i<=b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;
typedef long long ll;
ll n,a,b,c,d,ok;
int main()
{
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	//printf("%lld\n",d-c);
	n-=1;
	ll tar=b-a;
	fo(x,0,n)
	{
		ll y=(n-x);
		ll sta=tar-x*c+y*d;
		if (sta>=0)
		{
			if (sta<=n*(d-c))
				ok=1;
		}
	}
	if (ok) printf("YES\n"); else printf("NO");
}

Measured memory_bytes: 128
#include <stdio.h>
  #include <math.h>
  int min(int a,int b){
    return a<b ? a:b;
  }
  int max(int a,int b){
    return a>b ? a:b;
  }

  int main() {
    int a,b,c,som=0;
    scanf("%d %d",&a,&b);
    for (int i = 0; i < b; i++) {
      scanf("%d",&c);
      som+=c;
    }
    if (som>=a) {
      printf("Yes\n");
    }
    else
    printf("No\n");
    return 0;
  }


Measured memory_bytes: 128
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) a.begin(), a.end()
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#define dumpl(x) cerr << #x << " = " << (x) << " " << endl;
#else
const bool test = false;
#define dump(x) 
#define dumpl(x) 
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}
 
template<typename T>
T gcd(T a, T b)
{
  T c;
  while (a != 0) {
    c = a; a = b%a;  b = c;
  }
  return b;
}

int pow(int a, int b) {
  int res = 1;
  rep(i, b) res *= a;
  return res;
}
 
class Solver {
public:
  int N;
  char s[105];

  bool exists_y() {
    rep(i, N) {
      if (s[i] == 'Y') return true;
    }
    return false;
  }

  void solve() {
    cin >> N;
    rep(i, N) cin >> s[i];
    // rep(i, N) dump(s[i]);
    string res = (exists_y() ? "Four" : "Three");
    cout << res << endl; 
  }
};
 
signed main()
{
  srand(time(NULL));
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {    
  //     auto ptr = new Solver();
  //     ptr->solve();
  //     delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'


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

namespace AOJ0095
{
    class Program
    {
        static void Main()
        {
            var winner = (from competitor in ReadInput()
                          orderby competitor.Point descending, competitor.Id
                          select competitor)
                .First();

            Console.WriteLine("{0} {1}", winner.Id, winner.Point);
        }

        private static IEnumerable<Competitor> ReadInput()
        {
            var count = int.Parse(Console.ReadLine() ?? "");

            for (var i = 0; i < count; i++)
            {
                var values = (Console.ReadLine() ?? "").Split(" ".ToArray(), StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
                yield return new Competitor(values[0], values[1]);
            }
        }
    }

    class Competitor
    {
        public int Id { get; private set; }
        public int Point { get; private set; }

        public Competitor(int id, int point)
        {
            Id = id;
            Point = point;
        }
    }
}

Measured memory_bytes: 10620
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{

  set<int> SET;
  int N;
  cin>>N;
  bool check = true;

  for (int i = 0; i < N; i++)
  {
    int A;
    cin>>A; 

    auto X = SET.insert(A);
    if(X.second == false) check = 0;
 
  }

  if(check == true)
  {
    cout<<"YES"<<endl;
  }
  else
  {
    cout<<"NO"<<endl;
  }
  
  

  
  return; 
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

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

int main(){
  int A, B;
  cin >> A >> B;
  int res = 0;
  
  for(int i = A; i <= B; i++){
    int s = i % 10;
    int t = i / 10000;
    int u = i / 10 % 10;
    int v = i / 1000 % 10;
    if(s == t && u ==v){
      res++;
    }
  }
  cout << res << endl;
}

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

int main()
{
	int Mt[9];
	int i,w,max,second,third;
	
	for ( i = 0; i <= 9; i++)
	{
		cin >> Mt[i];

	}
	
	 max = Mt[0];

	for (i = 0; i <= 9; i++)
	{
		
		w = Mt[i];

		if (max < Mt[i])
		{
			Mt[i] = max;
			max = w;
		} //max??????

		//max,second,third????????????
	}
	
	 second = Mt[1];
    
	for (i = 1; i <= 9; i++)
	{
		w = Mt[i];

		if (second < Mt[i])
		{
			Mt[i] = second;
			second = w;
		}
	}

	 third = Mt[2];

	 for (i = 2; i <= 9; i++)
	 {
		 w = Mt[i];

		 if (third < Mt[i])
		 {
			 Mt[i] = third;
			 third = w;
		 }
	 }

	cout << max << endl;
	cout << second << endl;
	cout << third << endl;
  return 0;
}

Measured memory_bytes: 3068
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;


int main() {
		int A, B;
		cin >> A >> B;
		double Amin, Amax,Bmin,Bmax;
		if (A % 2 == 0) {
			Amin = (A / 0.08);
			Amax = ((A + 1) / 0.08) - 0.5;
		}
		else {
			Amin = A / 0.08 + 0.5;
			Amax = ((A + 1) / 0.08) - 1;
		
		}

		Bmin = B / 0.1;
		Bmax = ((B + 1) / 0.1) - 1;

		//cout << Amin << endl << Amax << endl << Bmin << endl << Bmax << endl;

		if (Amax < Bmin || Bmax < Amin) {
			cout << -1 << endl;
		}
		else if (Amin <= Bmin && Bmin <= Amax) {
			cout << Bmin << endl;
		}
		else if (Bmin <= Amin && Amin <= Bmax) {
			cout << Amin << endl;
		}
		
	
	
		return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int asc(const void* a, const void* b)
{
	if (*(long long int*)a > * (long long int*)b)return 1;
	if (*(long long int*)a < *(long long int*)b)return -1;
	return 0;
}
long long int count(long long int n, long long int p)
{
	long long int res = 0;
	while (n % p == 0)
	{
		res++;
		n /= p;
	}
	return res;
}
long long int modpow(long long int a, long long int n, long long int p)
{
	if (n < 0)
		return 0;
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
int main()
{
	long long int n;
	scanf("%lld", &n);
	long long int i, j;
	long long int a[10004];
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	int maxa = 0;
	for (i = 0; i < n; i++)
		if (maxa < a[i])
			maxa = a[i];
	if (maxa == 1)
	{
		printf("%lld\n", n);
		return 0;
	}
	long long int p = 1000000007;
	long long int q[1000006], lq = 0, aa;
	for (i = 0; i < n; i++)
	{
		aa = a[i];
		for (j = 2; j * j <= aa; j++)
		{
			if (aa % j == 0)
			{
				q[lq] = j;
				lq++;
				while (aa % j == 0)
					aa /= j;
			}
		}
		if (aa > 1)
		{
			q[lq] = aa;
			lq++;
		}
	}
	qsort(q, lq, sizeof(long long int), asc);
	long long int c = 1;
	long long int b[100005];
	b[0] = q[0];
	for (i = 1; i < lq; i++)
	{
		if (b[c - 1] < q[i])
		{
			b[c] = q[i];
			c++;
		}
	}
	long long int max[100005];
	for (i = 0; i < c; i++)
		max[i] = 0;
	long long int r;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < c; j++)
		{
			r = count(a[i], b[j]);
			if (max[j] < r)
				max[j] = r;
		}
	}
	long long int ab = 1;
	for (i = 0; i < c; i++)
		ab = ab * modpow(b[i], max[i], p) % p;
	long long int ans = 0;
	for (i = 0; i < n; i++)
		ans = (ans + ab * modpow(a[i], p - 2, p) % p) % p;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 2684
#include <iostream>
#include<cmath>
using namespace std;
#define int long long
#define MOD 1000000007

int dp[1001][1001];
char in[1001][1001];

signed main() {
    int a,b;
    cin>>a>>b;
    for(int i=0;i<a;i++){
        cin>>in[i];
    }
    dp[0][0]=1;
    for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
            if(in[i][j]=='#')continue;
            if(i-1>=0){dp[i][j]=(dp[i-1][j]+dp[i][j])%MOD;}
            if(j-1>=0)dp[i][j]=(dp[i][j-1]+dp[i][j])%MOD;

        }
    }
    cout<<dp[a-1][b-1]<<endl;
}

Measured memory_bytes: 9088
#include <stdio.h>


int main() {
	long a,b;
	long d, x;
	double r;
	
	scanf("%ld %ld", &a, &b);
	
	d = a/b;
	x = a%b;
	r = (double)a / (double)b;
	
	printf("%d %d %lf",(int)d, (int)x, r);
	
	return 0;
}

Measured memory_bytes: 636
mod = 10**9+7
N,K=map(int,input().split())
A = [int(i) for i in input().split()]

tento = []
ookii = []#自分より大きい数のあつまり
for i,a in enumerate(A):
  te=0
  oo=0
  for j,b in enumerate(A):
    if j==i:continue
    if b>a:
      oo+=1
      if j<i:
        te+=1
  tento.append(te)
  ookii.append(oo)
Tent = sum(tento)%mod
Lar = sum(ookii)%mod
L = Lar *K*(K-1)//2
R = Tent*K

print((L+R)%mod)

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

int bubbleSort(int A[], int N) {
  int sw = 0;
  bool flag = 1;
  for (int i = 0; flag; i++) {
    flag = 0;
    for (int j = N - 1; j >= 1; j--) {
      if (A[j] < A[j - 1]) {
        swap(A[j], A[j - 1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}

int main() {
  int A[100], N, sw;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];

  sw = bubbleSort(A, N);

  for (int i = 0; i < N; i++) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;

  return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include <math.h>
using namespace std;

int main(){

   int h,w;
   bool flag=true;
   char array[50][50];

    cin >> h >> w;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>array[i][j];
        }
    }

    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(
                array[i][j]=='#'
             && array[i-1][j]!='#' 
             && array[i][j-1]!='#' 
             && array[i+1][j]!='#'
             && array[i][j+1]!='#'
             ){
                flag=false;
            }
        }
    }

    if(flag==true) cout << "Yes";
    else cout << "No";
    
}

Measured memory_bytes: 256
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,k,s;
    cin>>n>>k>>s;
    for(ll i=0;i<k;i++)
    {
        cout<<s<<' ';
    }
    ll N = 1e9;
    for(ll i=k;i<n;i++)
    {
        if(s==1e9)
        {
            cout<<N-1<<' ';
        }
        else
        {
            cout<<N<<' ';
        }
    }
    return 0;
}



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

using namespace std;
#define sz(a) int(a.size())
#define ll  long long
#define ull unsigned long long
#define mod (ll)(1000000007)
#define endl '\n'
#define ENGZ ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define pi double(acos(-1))
#define S second
#define F first
#define mem(arr,a) memset(arr,a,sizeof arr)
//  freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ll fp(ll n , ll p )
{
    if(p==0)
        return 1 ;
    if(p==1)
        return n%mod ;
    ll res ;
    res = fp(n,p/2)%mod;
    res = (res*res)%mod ;
    if(p%2)
        res = (res*n)%mod ;
    return res;
}


int main()
{
    ENGZ;
    double ans = 0 , n , a ;
    cin>>n ;
    for(int i=0 ; i<n ; i++)
    {
        cin>>a ;
        ans+=(1/a)*1.0000000 ;
    }
    ans = 1/ans ;
    cout<<ans <<endl ;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>

//#define DEBUG 1
#define PI 3.14159265359

void set_point(double *x, double *y, int dis, int angle, int *def);

main()
{
	double x = 0;
	double y = 0;
	int def = 90;
	int dis = 0;
	int angle =0;
	char *input;
	while(scanf("%d,%d", &dis, &angle) != EOF)
	{
	
		if(dis == 0 && angle == 0)
		{
			break;
		}
		
		set_point(&x, &y, dis, angle, &def);
	}
	printf("%d\n%d\n", (int)x, (int)y);
	return 0;
}

void set_point(double *x, double *y, int dis, int angle, int *def)
{
	double rad = *def * (PI / 180);
	double x_point = dis * cos(rad);
	double y_point = dis * sin(rad);
#ifdef DEBUG
	printf("x = %d\ny = %d\n", x_point, y_point);
#endif
	*x = *x + x_point;
	*y = *y + y_point;
	*def = *def - angle;
}

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


int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(auto& x: a){
		cin >> x;
	}
	int devide = 2; // 0+ 1-
	int count = 0;
	for(int i = 0; i < n-1;i++){
		int mi;
		mi = a.at(i+1) - a.at(i);
		if(devide == 2){
			if(mi < 0) devide = 1;
			if(mi > 0) devide = 0;
		}
		if((mi > 0) && (devide == 1)){
			count++;
			devide = 2;
		}
		if((mi < 0) && (devide == 0)){
			count++;
			devide = 2;
		}
	}

	cout << count+1 << endl;
}


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

string FMT_F = "%.15f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto a = RDA;
	auto b = RDA;
	auto c = new long[](N);
	foreach (i; 0..N)
	{
		c[i] = b[i] - a[i];
	}
	debug writeln(a);
	debug writeln(b);
	debug writeln(c);

	long cnt1, cnt2;
	foreach (i; 0..N)
	{
		if (c[i] < 0)
			cnt1 += c[i].abs;
		else
			cnt2 += c[i] / 2;
	}

	writeln(cnt2 >= cnt1 ? "Yes" : "No");
	stdout.flush();
	debug readln();
}

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

using namespace std;

int main(){
	long long n;
	cin>>n;
	long long ans=0;
	for(int i=1;i<=n;i++)
		ans += ((n/i)*((n/i)+1)*i)/2;
	cout << ans << endl;
	return 0;
 } 


Measured memory_bytes: 3604